From 14655f4b2453b1dc13a1e954d56d5714e123a61b Mon Sep 17 00:00:00 2001 From: Jim Date: Mon, 23 Mar 2015 13:46:21 -0400 Subject: [PATCH] add V combinator to lambda_evaluator --- code/lambda_evaluator.mdwn | 2 +- code/parse.js | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) 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 -- 2.11.0