Struggling with simple-linked-list as given

I’m struggling with the simple-linked-list exercise … and I’m not sure that it’s just me … there aren’t that many submissions. It’s marked as “medium”, but it feels “hard.”

Some thoughts … I’m not a scala expert, so I’m not sure.

  • Going in sequence, this is practically the first exercise (aside from Forth) that uses trait; it’s not an easy introduction.
  • Add to this, the trait given in the problem makes it challenging to get to an idiomatic solution, and it is unclear that modifying the prompted trait is “okay.”

So, that said, … modifying the exercise might smooth out the challenge

  • Changing the trait to be covariant SimpleLinkedList[+T] (from invariant [T])
  • Changing the add method have a lower bound def add[U >: T](item: U) ...
  • add is harder to implement than prepend (getting the list ordering right is tricky and well… recursion hurts my brain) … if that’s a pedagogic goal, then great, but maybe a less ambitious target would be nice, and then maybe a harder challenge later in the series for add/append and reverse
1 Like

Thanks for the issue and for writing in such an empathetic way :slight_smile:

I’ll leave your second point and the suggested changes to people who know Scala (cc @ErikSchierboom) but one comment/FYI on your first point. As there’s not a learning mode, the idea of introducing concepts in general is not very well sequenced or likely to be thought out. In tracks where there are Learning Modes, a huge amount of work has gone into thinking about the order of introduction of concepts. It’ll be more ad hoc in those that haven’t.

If this sounds okay, i could make up a pull request, so there’s something more concrete to work with. it would be my first to exercism

Yep - I’m happy for that. Thanks! It’ll automatically get closed, but please ping a link here when you add it and I’ll reopen it for you :)