# It's all Geek to me?

Levi Pearson levi at cold.org
Wed Feb 21 13:22:30 MST 2007

```Steve <smorrey at gmail.com> writes:
>
> http://www.lua.org/pil/6.html
> "(It also means that Lua contains the lambda calculus properly.) "
>
> [snip]
>
> But what the heck does it mean to "contain the lambda calculus properly"?

Although Jacob's definition is probably correct, I'm not sure that's
the meaning they intended to convey.  I believe that their intent is
probably to state that Lua expression evaluation is modeled after the
applicative-order untyped lambda calculus.

What this means is, roughly, that variable scope is static and that
functions are first-class; i.e. they can be passed and returned from
other functions as values.  By 'applicative-order', I mean that
function arguments are always evaluated before the function is called.
This is a less-powerful version of the lambda calculus, since there
are expressions that would converge (produce a valid result) in the
normal-order lambda calculus but diverge (get caught in an infinite
loop or otherwise not produce a result) with applicative-order.  The
two both produce the same result in pure (meaning without
side-effects) lambda calculus, but applicative-order makes dealing
with side-effects much easier.

The lambda calculus is interesting in that it is a fundamental model
of computing that is equivalent to the Turing Machine in
expressiveness (see a discussion of the Church-Turing thesis for more
details) but is often easier to work with in a mathematical sense to
prove properties of computations.  Pure lambda calculus would still be
rather awkward to express a complex algorithm in, but languages
modeled after it can take advantage of its mathematical properties to
perform powerful automatic program transformations to perform
optimizations, etc.

For your purposes as a MUD scripting language, this doesn't mean a
whole lot, but it is at least evidence that the people who designed it
have some clue what they're doing, which should be reassuring. :)

--Levi

```