Reply to post: Recursion

Learn you Func Prog on five minute quick!

MacroRodent

Recursion

Stobb forgot to discuss one important dogma of Functional Programming: No loops, ever. Use mapping, reduction or recursion instead. For the last part, I have never quite understood what makes recursion always superior over good old "while". In those cases where a loop would suffice, recursion is just a GOTO to the beginning of the function. On the other hand, in a pure FP language where variables can never be reassigned, a "while" would be pointless, so these go hand in hand.

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon