Testing
I have included the following tests. They can be run by clicking on eval. You can modify them as you see fit. They are borrowed from TaPL.
Logical Operators
// Logic let id = \ v . v; // operators let true = \ t . \ f . t; let false = \ t . \ f . f; let and = \ b . \ c . b c false; let or = \ b . \ c . b true c; let not = \ b . b false true; let imp = \ b . \ c . or (not b) c; // conditional let test = \ l . \ m . \ n . l m n; // testing //test (not true) if else test (imp false true) if elsePairs
let id = \ v . v; // operators let true = \ t . \ f . t; let false = \ t . \ f . f; let and = \ b . \ c . b c false; let or = \ b . \ c . b true c; let not = \ b . b false true; let imp = \ b . \ c . or (not b) c; // conditional let test = \ l . \ m . \ n . l m n; // pairs let pair = \ f . \ s . \ b . b f s; let fst = \ p . p true; let snd = \ p . p false; // testing //fst (pair v w) test (imp (snd (pair false true)) (snd (pair true false))) if else //test (and (snd (pair false true)) (snd (pair true false))) if elseNumerals
Note that for now these are quite slow due to closure copies.
Closures #1
let id = \ v . v; let closure = (\ a . \ b . \ c . b c) ctest1 ctest2; // testing closure aClosures #2
let id = \ v . v; let f1 = \ a . a; let closure = (\ a . \ b . \ c . b c) cls1 (\ a . f1); closure aClosures #3
let id = \ v . v; let f1 = \ a . a; let closure = (\ a . \ b . \ c . b c a) cls1 (\ a . (\ b . b) f1); closure aWrite you own test
let id = \ v . v; idρ is again used to describe the scope environment. If you find any errors, please report those as a comment below.