3 <title>Lambda evaluator with lets</title>
4 <script language=JavaScript src="code/lambda.js"></script>
9 Try clicking on the "Reduce" button: <center><form>
10 <textarea cols="80" rows="20" name=input>
11 let true = (\x (\y x)) in
12 let false = (\x (\y y)) in
13 let and = (\l (\r ((l r) false))) in
17 ((((and false) false) yes) no)
19 ((((and false) true) yes) no)
21 ((((and true) false) yes) no)
23 ((((and true) true) yes) no)
29 <input type=button value="Reduce" onClick="mytry(this.form)">
31 <textarea cols="80" rows="10" name=result></textarea>
35 Notes: you have to fully specify parentheses and separate your lambdas. So for example, you can't write `(\x y. y)`; you have to write `(\x (\y y))`.
37 The parser treats symbols that haven't yet been bound (as `yes` and `no` in the example above) as free variables.
39 If you try to evaluate a non-terminating form, like `((\x (x x)) (\x (x x)))`, you'll probably have to force-quit your browser and start over. Anything you had earlier typed in the upper box will probably be lost.