Re:Is Lisp still useful in today's world? (2011)
by Falling3 on Thursday February 21, 2013 @01:06PM
(#5258928)
As far as I know (which isn't too much), there's nothing wrong with that. But since monkeyfacebag mentioned the psychology of code writing, there definitely seem to be algorithms that lend themselves to recursion. At the very least, some algorithms are more intuitively grasped as recursive - and the same obviously holds for iterative.
[ Parent
| on HN ]
Re:Is Lisp still useful in today's world? (2011)
by pavelludiq on Thursday February 21, 2013 @01:21PM
(#5259030)
yes, usually anything having to do with recursive structures, like threes, is a good fit for recursive algorithms. In fact, the function I wrote had to generate a directory structure out of a template: https://gist.github.com/pvlpenev/4760658 (and i still used loop :)
But keep in mind that some things, although recursively defined, are better computed in other ways, the most obvious example is a Fibonacci sequence, which if I really needed, I would precompute and stick in an array for constant time access or something like that(maybe memoize a recursive function).