Reverse-string exercise

In my explosion of new exercises, I notice reverse-string is not implemented. Obviously the solution can just call reverse which is no fun.

Two thoughts:

  1. we could mark it as foregone
  2. we could add it
    • with an instructions.append that asks users to avoid reverse
    • additionally, the perl5-analyzer can be extended to add some exercise-specific checks.

Feedback?

I would not mark it as foregone, I would add it.

Avoid built in reverse for String explicitly, while using reverse for some other data structure may be interesting, but not as interesting as perhaps just iterating by using a negative index, as a solution.

1 Like

Maybe formulate the canonical instructions to discourage builtins, as was done for the square root instructions lately?

1 Like

If the specs are updated later on to incorporate such restrictions, the Perl exercise will end up with duplicated information. Many languages have built in functions for reversing strings, don’t they?

They do, and maintainers maintain the track to hopefully catch these things when that happens.

I was drafting a forum post to suggest changing the canonical description for reverse-string. It got me to thinking about where the exercise fits in the order of exercises. For most tracks, it’s one of the very earliest exercise, with a very low difficulty. I’m now thinking that it’s useful to allow students to simply use the builtin functionality: it gets them to do a speck of research into the docs, quickly solve the exercise and move on. Good for student motivation. And if a student wants to get fancy, there’s nothing to hold them back.

3 Likes

Exactly, for me, that usually happens when a student requests review for the exercise and I can encourage them to explore in other ways than how they solved it.

1 Like

My personal preference is not to mention any kind of suggestions or restrictions in the instructions of any exercise. Removing such restrictions would allow track maintainers to think about and add their own suggestions in a more flexible manner using an append file, without being restricted by pre-existing rules.

That’s also why I had an issue with eliuds-eggs and got confused. This would not have happened if that restriction wasn’t there.