4 ms·
>> Having said that; their points are valid because in Clojure (and likely most, if not all functional languages) recursion should be seen as a low-level2 opera
by brisance 16y ago
>> Having said that; their points are valid because in Clojure (and likely most, if not all functional languages) recursion should be seen as a low-level2 operation and avoided if at all possible.
That part was even in bold. Which totally runs counter to what Scheme emphasizes (recursion wherever possible).
- fogus 16y agorecursion wherever possible Because in Scheme (R5RS anyway, I have not kept up with 6) recursion is the primary means of iteration.
- jerf 16y agoI'm not 100% certain you got the point, which is that in Clojure (and Haskell and I'm sure others) recursion is used "whenever possible" but given a choice you should use the pre-rolled recursions available in the various combinators, not implement it yourself directly. fold, map, filter, and a wide variety of other things are all recursive, but the recursion can and should be factored away. A "map" is utterly clear what is going on. The handwritten recursive version of a map requires a bit of analysis to be quite sure there's nothing tricky in the function being mapped, especially as the function being mapped gets large.