X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=blobdiff_plain;f=lambda_evaluator.mdwn;h=7228fca7a6081714c2d874b53db032ff00f6be06;hp=16eace75deb7f136ab8866ca72764d778eb5d1fa;hb=8dd323ab2d93d590e51cfe30de3cb89d2840f175;hpb=95e1d6e5ad4b98f8f8b359fb0033c913086f98d3;ds=sidebyside diff --git a/lambda_evaluator.mdwn b/lambda_evaluator.mdwn index 16eace75..7228fca7 100644 --- a/lambda_evaluator.mdwn +++ b/lambda_evaluator.mdwn @@ -13,10 +13,25 @@ In this toy system, `let`s should only be used at the beginning of a file. If w let true = (\x (\y x)) in let false = (\x (\y y)) in - ((true true) false) + ((true yes) no) -the result is `true`. +the result is `yes`. Things to watch out for: the expression after the equal sign must have balanced parentheses, +and the "in" is obligatory. The system will still produce a result, but it won't make much sense. + +*Abbreviations*, **NOT**: No abbreviations work. So `\xy.yxx` must be written `(\x (\y ((y x) x)))`. (As in Scheme or Racket.) + +*Comments*: anything following a semicolon to the end of the line is ignored. +Blank lines are fine. + +Under the hood +--------------- + +The interpreter is written in JavaScript (which is not closely related to Java), and runs inside your browser. +So if you decide to reduce a term that does not terminate (such as `((\x (x x)) (\x (x x)))`), it will be your +browser that stops responding, not the wiki server. + +You can inspect the code [here](http://lambda.jimpryor.net/code/lambda.js). Suggestions for improvements welcome. + +Improvements we hope to add soon: the ability to reduce Combinatory Logic combinators; the ability to translate from CL to the lambda calculus; and more sensible variable names instead of `g354`. -*Comments*: -[more soon]