On Thu, Apr 24, 2014 at 6:21 AM, Joerg Arndt <arndt@jjj.de> wrote:
* Robert Smith <quad@symbo1ics.com> [Apr 24. 2014 14:09]:
I think he was referring to the C++, not the combinator. :)
Actually both, but foremost the combinator. I tried to get the gist of the things in the past and consistently failed.
Lambdas are sometimes called "anonymous" functions because they don't have names. Without a name, it becomes tricky to do recursion. One idea is to write your code twice (what follows is javascript): ((f) => (n) => { if (n === 0) return 1 else return n * f(f)(n-1) }) ((f) => (n) => { if (n === 0) return 1 else return n * f(f)(n-1) }) This takes the first code block and applies it to the second one, and since f is bound to one of these code blocks, f(f) is the same as the code above. The Y combinator handles the duplication for you so you only have to write the code once. Of course, any modern language allows names for functions, so it's pretty much useless unless you're trying to explain some of the finer points of the Curry-Howard isomorphism. -- Mike Stay - metaweta@gmail.com http://www.cs.auckland.ac.nz/~mike http://reperiendi.wordpress.com