Oh I see what u mean. I've updated the post entirely since but probably haven't made the changes u wanted. I get how addLetter should not be the one that handles the logic behind whether to add or not but I do think this keeps things easier to understand to those who dunno much about recursion. Thanks a lot for the feedback, much appreciated!!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
The recursiveness of addLetter is interesting.
It's clearly following a recursive flow mediated by a scheduler.
It does not support backtracking, but that's not a requirement.
The main objection I have is that it isn't expressed as a reursive operation.
It should be addLetters, which calls addLetter(first), and schedules addLetters(rest), or terminates.
This would express the recursive decomposition of the task. :)
Oh I see what u mean. I've updated the post entirely since but probably haven't made the changes u wanted. I get how addLetter should not be the one that handles the logic behind whether to add or not but I do think this keeps things easier to understand to those who dunno much about recursion. Thanks a lot for the feedback, much appreciated!!