I was just wondering where I could find some language-agnostic tutorials for what lambda functions are, what their use is, and rough equivalents in languages that don’t support them.
I would especially love any information on common notations.
Thanks! Please let me know if I can elaborate on this at all.
EDIT: Oh hey I forgot something.
Just in terms of terminology, what’s the difference between a lambda expression or function, an anonymous/delegate function, and a closure?
Regarding terminology:
A lambda expression is the original way of writing an anonymous function invented by Alonzo Church for the lambda calculus. In the lambda calculus, all functions are pure: there are never any side effects.
The lambda expression was adopted by McCarthy for LISP as
(lambda (arguments ...) body), which is spelled “lambda”. Sussman and Steele later made the semantics more faithful to Church’s original. The expression was also adopted by Haskell as\ arguments ... -> body, and the backslash intended to look like a lambda, but the Haskell committee used a right arrow instead of a dot because they wanted the dot for function composition. The expression was adopted by Robin Milner for ML but is spelled even more strangely:fn args => body. All these expressions are properly called lambda expressions, and all represent anonymous functions. Only in Haskell are the functions pure; Lisp, ML, and Scheme all permitbodyto have side effects.A closure is what you get when you evaluate a lambda expression or other kind of nested function. The closure contains not just the compiled code for the lambda expression but also information about the free variables. (In Lisp and Scheme, the closure stores the locations of the free variables; in Haskell and ML, the closure stores the values of the free variables.)
An anonymous function is a more general concept and need not be restricted to a simple binding and body. For example, in Smalltalk a “block” represents an anonymous function, but the body of a block is a sequence of statements, so it is definitely not the same as a lambda expression.
I’m afraid I can’t help you with “delegate function;” in my world, that term is used to describe something else entirely.