
struggled with number representation and tried many different schemes, before the modern
standard of 2-complement for integers and floating point for reals was generally adopted.
Vi
`
ete’s notation for expressions was the main innovation in FORTRAN, the world’s first
high-level programming language (Backus 1953), thus liberating the programmer from
writing out tedious sequences of assembly instructions. Not too long after this, 1960, Mc-
Carthy came out with his list processing language Lisp. McCarthy knew of the λ-calculus,
and his language closely resembles it.
Today, not many languages offer the powerful descriptive facilities of the λ-calculus,
in particular, the mainstream languages Java and C++ make a strict distinction between
primitive datatypes and objects, on the one hand, and functions (= methods), on the other
hand. Likewise, the line of development started with Lisp, although it led to some truly
remarkable languages such as ML and Haskell, has found it difficult to incorporate object
oriented features. The OCaml dialect of ML is one of the few attempts to combine the two
paradigms.
2. Expressions in the λ-calculus. The λ-calculus is a notation for functions. It is extremely
economical but at first sight perhaps somewhat cryptic, which stems from its origins in
mathematical logic. Expressions in the λ-calculus are written in strict prefix form, that is,
there are no infix or postfix operators (such as +, −, (
)
2
, etc.). Furthermore, function and
argument are simply written next to each other, without brackets around the argument. So
where the mathematician and the computer programmer would write “sin(x)”, in the λ-
calculus we simply write “sin x”. If a function takes more than one argument, then these
are simply lined up after the function. Thus “x + 3” becomes “+ x 3”, and “x
2
” becomes
“∗ x x”. Brackets are employed only to enforce a special grouping. For example, where
we would normally write “sin(x) + 4”, the λ-calculus formulation is “+ (sin x) 4”.
3. Functions in the λ-calculus. If an expression contains a variable — say, x — then one can
form the function which obtains by considering the relationship between concrete values
for x and the resulting value of the expression. In mathematics, function formation is
sometimes written as an equation, f (x) = 3x, sometimes as a mapping x 7→ 3x. In the
λ-calculus a special notation is available which dispenses with the need to give a name to
the function (as in f (x) = 3x) and which easily scales up to more complicated function
definitions. In the given example we would re-write the expression “3x” into “∗ 3 x” and
then turn it into a function by preceding it with “λx.”. We get: “λx. ∗ 3 x”. The Greek
letter λ (“lambda”) has a role similar to the keyword “function” in some programming
languages. It alerts the reader that the variable which follows is not part of an expression
but the formal parameter of the function declaration. The dot after the formal parameter
introduces the function body. Let’s look more closely at the similarity with programming
languages, say Pascal:
function f( x : int) : int begin f := 3 ∗ x end;
| | | |
λ x . ∗ 3 x
You may be interested to see the same in Lisp:
(lambda (x) (∗ 3 x))
4. And on and on... A function which has been written in λ-notation can itself be used in
an expression. For example, the application of the function from above to the value 4
is written as (λx.∗ 3 x) 4. Remember, application is simply juxtaposition; but why the
brackets around the function? They are there to make clear where the definition of the
function ends. If we wrote λx.∗ 3 x 4 then 4 would become part of the function body
and we would get the function which assigns to x the value 3 ∗ x ∗ 4 (assuming that ∗ is
interpreted as a 3-ary function; otherwise the λ-term is nonsensical, see below.). So again,
2