From fdf35536b66499884dd5b4e1740ac67e5cebb1a2 Mon Sep 17 00:00:00 2001 From: tzlil Date: Fri, 14 Apr 2023 23:46:53 +0300 Subject: add homework material --- tests/examples/fac-three.lam | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 tests/examples/fac-three.lam (limited to 'tests/examples/fac-three.lam') diff --git a/tests/examples/fac-three.lam b/tests/examples/fac-three.lam new file mode 100644 index 0000000..613c933 --- /dev/null +++ b/tests/examples/fac-three.lam @@ -0,0 +1,31 @@ +(\ zero one two three succ plus mult pred minus isZero yComb . + (\ fac . + fac three + -- NOTE: the y-combinator does not have a normal form + ) (yComb (\ f n . (isZero n) one (mult n (f (pred n))))) +) + +-- zero +(\ f x . x) +-- one +(\ f x . f x) +-- two +(\ f x . f (f x)) +-- three +(\ f x . f (f (f x))) + +-- succ +(\n f x . f (n f x)) +-- plus +(\m n f x . m f (n f x)) +-- mult +(\m n f . m (n f)) +-- pred +(\n f x . n (\ g h . h (g f)) (\ u . x) (\ u . u)) +-- minus +(\ m n . n (\n f x . n (\ g h . h (g f)) (\ u . x) (\ u . u)) m) +-- isZero +(\ n . n (\ x . (\ x y . y)) (\ x y . x)) + +-- yComb +(\ f . (\ x . f (x x)) (\ x . f (x x))) -- cgit 1.4.1