From d03956f54d15f4904cfa10be96bbdf11d49a68f0 Mon Sep 17 00:00:00 2001 From: c+1 Date: Sun, 14 May 2023 09:41:14 -0400 Subject: halk --- examples/functional.halk | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'examples') diff --git a/examples/functional.halk b/examples/functional.halk index ba61210..d050662 100644 --- a/examples/functional.halk +++ b/examples/functional.halk @@ -3,8 +3,21 @@ use of '=>' instead of '->', to denote a function whom's arguments are immutable.] let.Y => { - λ.f => { - λ.x => f.x.x; - }.λ.x => f.x.x; + λ.b => { + (λ.f => { b.λ.x => { (f.f).x } }). + (λ.f => { b.λ.x => { (f.f).x } }); + } } +let.Fact => { + Y.λ.fact => {λ.n => { + if.(zero?.n), { + 1; + }, { + *.n, (fact. -.n, 1); + } + }} +} + +(define Fact + (Y (λ (fact) (λ (n) (if (zero? n) 1 (* n (fact (- n 1)))))))) -- cgit v1.2.3