4 ms·
afaik it's pretty academic. The only practical application is to allow recursion in languages that don't do recursion which is pretty much none. This is a good
by axod 16y ago
afaik it's pretty academic. The only practical application is to allow recursion in languages that don't do recursion which is pretty much none.
This is a good description if you're into that sort of thing: http://mvanier.livejournal.com/2897.html http://mvanier.livejournal.com/2897.html
The meat of it is that you can 'do' recursion by building up functions that call other functions :/ meh
- simplegeek 16y ago>> The only practical application is to allow recursion in languages that don't do recursion which is pretty much none. Above is a very hard sentence to parse for non-native speakers, just saying ;)
- ericb 16y agoWow, hmm.. I worked a MEDITECH a long time ago, and they actually used a programming language, MAGIC, that you couldn't recurse in. It used macro code expansion to take MAGIC code and output into a lower level language and recursion would make it loop infinitely. Maybe at MEDITECH it wouldn't have been so academic. Edit: Not sure why this got downvoted, but in their internal programming course they talked about the recursion problem explicitly--I'm not making this up, as crazy as it sounds. If you don't believe me, here is a link to a blog post with someone else mentioning it in the comments: http://htmlcoderhelper.com/what-is-the-worst-programming-language-you-ever-worked-with/ http://htmlcoderhelper.com/what-is-the-worst-programming-lan...
- axod 16y agoWhy is it an issue though? Recursion is an optional thing some programmers like using. It's not necessary. edit: rather than downmod me to -1 for stating a fact, why not reply?
- smanek 16y agoThat's like saying integers are an optional thing, and it's no big deal if your programming language doesn't have them. True, they aren't necessary (look at peano arith or pure lambda calc) - but it sure makes things a lot easier. It's much more concise and intuitive to write some search or divide and conquer algos recursively than imperatively.
- axod 16y agojavascript doesn't have an integer type. Possibly it makes things easier for some algorithms, but as I said, it is optional. It's not rocket science to rewrite any algorithm that relies on recursion to not need it.
- spacemanaki 16y agoThe "meat" of it is really that (Y F) = (F (Y F)). In other words Y applied to a function F expands to F applied the original expression, so it builds up nested calls of F. I can't do it justice, but it's definitely much more interesting and even beautiful than "meh". I guess there are always "practical" vs "academic" arguments to be made but I find stuff like the lambda calculus, Y, Church numerals, all really cool.
- axod 16y agoYeah 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.