Re:Lambdas in C
by brohee on Friday July 01, 2011 @10:11AM
(#2718382)
Am I really out of my mind or is this not a lambda at all but just an anonymous function?
[ Parent
| on HN ]
Re:Lambdas in C
by StrawberryFrog on Friday July 01, 2011 @11:14AM
(#2718638)
If an anonymous function can capture state from the enclosing code block, and outlive that code block, then it's a lambda.
So this probably isn't really a lambda.
That's the definition of a closure. I'm not sure if "lambda" is necessarily synonymous with "closure" or just synonymous with "anonymous function", but lambdas are closures in many languages.
Re:Lambdas in C
by StrawberryFrog on Sunday July 03, 2011 @10:39AM
(#2723755)
You're right, my terms are sloppy. Are there rigorous definitions, or does it vary between languages?.
I think of "lambda" as a language construct that creates closures. "anonymous functions" are of course just a simpler subset of closures.