Hacker News new | ask | show | jobs
by slezakattack 2649 days ago
I'm glad Erlang gave you the feature you were looking for but I can't help think of what the cases would be where a map, fold, or even assigning a lambda function to a variable wouldn't work?
1 comments

95% of the time, a fold or map are fine. Typically the reason that I use recursion explicitly is when I want to early-exit a loop. In imperative languages, that's trivial, just do a break or something, but in functional, that sort of goes against the point of a map or fold.

Also, it's useful for any other particular reason you might need recursion (e.g. directory traversal)

EDIT: In regards to assigning it to a variable, I don't believe that will work, since the naming comes after the fact. I could be wrong on that.

Thank you for the response. I totally agree on the early-exit loop problem