2 ms·
You probably shouldn't be using recursion either. maps, folds, and scans are the bread and butter of FP programming. tail recursion is almost as bad as a normal
by smabie 6y ago
You probably shouldn't be using recursion either. maps, folds, and scans are the bread and butter of FP programming. tail recursion is almost as bad as a normal loop, and shouldn't be necessary most of the time. The most reasonable use of tail recursion is when the combination of the above operations doesn't have good enough time complexity, necessating that you do everything at once.
Though, when I programmed CL in the past I used the iterate macro, which I found a lot nicer than the ugly loop one.
- dreamcompiler 6y agoCL has maps and folds (the latter it calls REDUCE) and I definitely prefer them to any form of iteration when they make sense.