3 ms·
Recursion isn't worthwhile in Java because of 1) a lack of tail-recursion and 2) the clunkiest possible syntax and most restrictive possible semantics for lambd
by william42 15y ago
Recursion isn't worthwhile in Java because of 1) a lack of tail-recursion and 2) the clunkiest possible syntax and most restrictive possible semantics for lambdas.
- esrauch 15y agoThis is a very strong statement. AFAIK most languages don't have do tail-recursion in general (Even most implementations of common lisp, and Clojure only if you use a special keyword). Recursion is worthwhile in certain cases in any language where the problem naturally calls for recursion; things like DFS and BFS are a lot uglier without recursion. Lambdas and first class functions really aren't necessary for a lot of situations where recursion is natural, and in those scenarios it is clearly worthwhile in Java.
- kaffiene 15y agoWhat rubbish. Recursion does not require lambdas and is quite obviously a different concept entirely. Tail recursion is (a) only an optimisation feature and (b) absent is most programming languages anyway. Pure FUD