diff --git a/programs/fib.lily b/programs/fib.lily new file mode 100644 index 0000000..db857f3 --- /dev/null +++ b/programs/fib.lily @@ -0,0 +1,14 @@ +defn if c t e = { + case c of { + True -> { t } + False -> { e } + } +} + +defn fibtr a b n = { + if (eq n 0) a (fibtr b (a+b) (n-1)) +} + +defn fib n = { fibtr 1 1 n } + +defn main = { fib 40 }