feat: initial commit

This commit is contained in:
lisk77 2025-06-30 19:43:09 +02:00
commit 0dd91da74f
17 changed files with 683 additions and 0 deletions

9
examples/booleans.lambda Normal file
View file

@ -0,0 +1,9 @@
true = \ x y . x;
false = \ x y . y;
not = \ p . p false true;
and = \ p q . p q p;
or = \ p q . p p q;
xor = \ p q . p ( not q ) q;
main = and true false;

13
examples/numbers.lambda Normal file
View file

@ -0,0 +1,13 @@
0 = \ f x . x;
1 = \ f x . f x;
2 = \ f x . f ( f x );
isZero = \ n . n (\ x . false) true;
succ = \ n f x . f ( n f x );
pred = \ n f x . n (\ g h . h ( g f )) (\u . x) (\u . u);
add = \ m n . n succ m;
sub = \ m n . n pred m;
mul = \ m n f . m ( n f );
exp = \ b n . n b;
main = add 2 1;

12
examples/pair.lambda Normal file
View file

@ -0,0 +1,12 @@
pair = \ x y z . z x y;
first = \ p . p (\ x y . x);
second = \ p . p (\ x y . y);
cons = pair;
head = first;
tail = second;
nil = \ x y . y;
isNil = \ l . l (\ h t d . (\ x y . y)) (\ x y . x);
main = first (pair a b);