A Kiss from the Lambda Calculus
By Igor Geier on Sep 24, 2008
This month, I went to the Berlin.jar conference (a Java conference in Berlin), a two-day event at the FHTW Berlin (university of applied sciences). This year, it was the first Berlin.jar and it's planned to do it again next year.
One of the many presentations was about the Ruby programming language. Like some other languages, the language contains the
lambda keyword. Historically it comes from the λ-calculus, a theory intended to be a foundation for mathematics (like Frege's logicism, this attempt failed). The keyword
lambda introduces an (anonymous) function (object). In particular a function can be returned by a function and can be a parameter to a function, including itself. The
lambda example, given in the presentation, was an anonymous function which takes no arguments and returns a random number.
This wouldn't be possible in the λ-calculus, nor in a pure functional programming language (e.g. Haskell). There the purpose of λ is to bind variable names, just like quantifiers do it in predicate logic, and a λ without variables is syntactically incorrect. It would also be impossible to have a function that doesn't always return the same value for the same arguments, a function with no formal parameters is simply a constant. In contrast, an imperative language allows side effects (the result of a function does not only depend on its arguments), therefore the meaning of the Ruby
lambda is not the same.
An imperative λ. How ironic. Walking around after the conference, I made this picture of a remaining segment of the Berlin Wall near Ostbahnhof (Brezhnev kisses Honecker, above "Lord, help me to survive" is written in Russian).