This calculator implements a normal-order evaluator for the untyped lambda-calculus with shortcuts. Shortcuts are distinguished constants that represent terms. An association between a shortcut symbol and a term must be declared before any term that contains the shortcut could be evaluated. The declaration of a shortcut does not cause the corresponding term to be evaluated. Therefore shortcut's term may contain other shortcuts -- or even yet to be defined ones. Shortcuts make programming in lambda-calculus remarkably more convenient. Besides terms to reduce, this lambda-calculator accepts a set of commands, which add even more convenience. Commands define new shortcuts, activate tracing of all reductions, compare terms modulo alpha-conversion, print all defined shortcuts and evaluation flags, etc. Terms to evaluate and commands are entered at a read-eval-print-loop (REPL) "prompt" -- or "included" from a file by a special command. Examples First we define a few shortcuts: (X Define %c0 (L f (L x x))) ; Church numeral 0 (X Define %succ (L c (L f (L x (f (c f x)))))) ; Successor (X Define* %c1 (%succ %c0)) (X Define* %c2 (%succ %c1)) (X Define %add (L c (L d (L f (L x (c f (d f x))))))) ; Add two numerals (X Define %mul (L c (L d (L f (c (d f)))))) ; Multiplication (%add %c1 %c2)

REPL reduces the term and prints the answer: (L f (L x (f (f (f x))))) . (X equal? (%succ %c0) %c1) (X equal?* (%succ %c0) %c1) The REPL executes the above commands and prints the answer: #f and #t , correspondingly. The second command reduces the terms before comparing them. This all looks suspiciously like Scheme. However, try the following two terms: (%mul %c1 e) and (%mul %c0 e) . The evaluator reduces the first term to e and the second one to (L f (L x x)) , which is %c0 . It must be stressed that in both terms e is a free variable. We can therefore take the evaluation result as a proof that a left-multiplication by 1 leaves a term e intact, while left-multiplication by zero yields zero -- for all terms! This is an algebraic result, a clear illustration of usefulness of lambda-calculus in logic and theorem-proof systems. On the other hand, try to evaluate (* 1 e) in Scheme with e being an unbound variable! The title comments to the source code of the calculator explain the differences between a call-by-value evaluator such as Scheme, an applicative-order lambda-calculator, a normal-order evaluator such as Scheme's macro-expander, and the present normal-order lambda-calculator.

