5 ms·
Yeah ok, it's sort of interesting as a curiosity. But it's going to be terribly inefficient if used, and doesn't really have any practical application. I've al
by axod 16y ago
Yeah ok, it's sort of interesting as a curiosity. But it's going to be terribly inefficient if used, and doesn't really have any practical application.
I've always been more of a practical "why not just use a loop" kinda guy, so it's probably wasted on me.
- abstractbill 16y agoRight, it's not really supposed to be used, but it's impressive and interesting in the same way that e^πi = -1 is.
- axod 16y agoI didn't really find that. It's just functions calling other functions. How exciting can that get :/
- abstractbill 16y agoIf you told me (before I knew about the Y combinator) that there was a function Y such that Y(F) = F(Y(F)) for every other function F, I doubt I would have believed you.
- eru 16y agoLoops are just a special case of recursion, and only necessary for languages that don't support recursion very well. As an example, Scheme and Haskell have no use for loops.
- axod 16y agoLoops are how most people think. They're also how most CPUs think. It seems to me logical for both parties to express programs mostly using loops.
- timtadh 16y agoExcept there is no difference at the machine instruction level between a recursive and iterative approaches. They are isomorphic to each other. That is why you can implement all recursive algorithms using an explicit stack and a loop and all iterative algorithms as recursive functions.
- axod 16y agoHuh? There's a lot of difference in the unoptimized form of recursion - namely stack usage. Yes you can hack together tail call recursion to try and make recursion perform as well as iteration does, but what really is the point?
- deleted 16y ago[deleted]
- eru 16y agoThe concept of recursion in is independent of computers. Recursion is just the mathematicians idea of how to repeat get arbitrarily big objects out of limited definitions. Loops are a just a special case, and not really closer to the hardware. Branches and jumps are closer to the hardware. "Yes you can hack together [a compiler] to try and make [structured programming] perform as well as [goto] does, but what really is the point?"