What are anonymous (lambda) functions? What is the formal definition of an anonymous function in a functional programming language?
In my simple terms, when I am programming in scheme/lisp I would say an anonymous (lambda) function is a function that is not bound to an identifier.
Is that all that you can say formally about a lambda function? I think there is more detail that can be added to this simple definition. Please elaborate, and thank you!
Asked By : CodeKingPlusPlus
Answered By : jmite
In my opinion, that's all you can really say about them.
The idea is that in a higher-order language, a function is just another kind of value. The same way you can have (3+4) without an identifier in C, you can have (lambda (x) +(3 x))) without an identifier in scheme.
The key here isn't that there's anything special about anonymous functions. It's only the restrictions of other languages that require functions be treated differently from any other value. The special definitions are for procedural languages which don't allow them, not for functional languages with do.
Best Answer from StackOverflow
Question Source : http://cs.stackexchange.com/questions/9655
0 comments:
Post a Comment
Let us know your responses and feedback