From: Jim Date: Mon, 23 Mar 2015 17:46:29 +0000 (-0400) Subject: Merge branch 'working' X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=commitdiff_plain;h=f7772d76917427a2c0e00e7bbc0cf78245f966cd;hp=78224e38c4180c85570589e3c9fabfe1fde5365e Merge branch 'working' * working: add V combinator to lambda_evaluator --- diff --git a/code/lambda_evaluator.mdwn b/code/lambda_evaluator.mdwn index 22319519..220f6139 100644 --- a/code/lambda_evaluator.mdwn +++ b/code/lambda_evaluator.mdwn @@ -19,7 +19,7 @@ Blank lines are fine. *Abbreviations*: In an earlier version, you couldn't use abbreviations. `\x y. y x x` had to be written `(\x (\y ((y x) x)))`. We've upgraded the parser though, so now it should be able to understand any lambda term that you can. -*Constants*: The combinators `S`, `K`, `I`, `C`, `B`, `W`, `T`, `M` (aka ω) and `L` are pre-defined to their standard values. Also, integers will automatically be converted to Church numerals. (`0` is `\s z. z`, `1` is `\s z. s z`, and so on.) +*Constants*: The combinators `S`, `K`, `I`, `C`, `B`, `W`, `T`, `V`, `M` (aka ω) and `L` are pre-defined to their standard values. Also, integers will automatically be converted to Church numerals. (`0` is `\s z. z`, `1` is `\s z. s z`, and so on.) *Variables*: Variables must start with a letter and can continue with any sequence of letters, numbers, `_`, `-`, or `/`. They may optionally end with `?` or `!`. When the evaluator does alpha-conversion, it may change `x` into `x'` or `x''` and so on. But you should not attempt to use primed variable names yourself. diff --git a/code/parse.js b/code/parse.js index ddc6199e..9712809b 100644 --- a/code/parse.js +++ b/code/parse.js @@ -212,12 +212,14 @@ var make_parse = function () { constant("B", make_lam3(u, v, x, make_app(uu, make_app(vv, xx)))); constant("C", make_lam3(u, v, x, make_app3(uu, xx, vv))); - // trush \uv.vu = CI + // trush \uv.vu = CI = box constant("T", make_lam2(u, v, make_app(vv, uu))); - // mockingbird \u.uu = SII - constant("M", make_lam(u, make_app(uu, uu))); + // vireo \uvw.wuv = pair + constant("V", make_lam3(u, v, x, make_app3(xx, uu, vv))); // warbler \uv.uvv = C(BM(BBT) = C(BS(C(BBI)I))I constant("W", make_lam2(u, v, make_app3(uu, vv, vv))); + // mockingbird \u.uu = SII = omega + constant("M", make_lam(u, make_app(uu, uu))); // lark \uv.u(vv) = CBM = BWB constant("L", make_lam2(u, v, make_app(uu, make_app(vv, vv)))); // Y is SLL