]> Witch of Git - ivy/blob - ivy-examples/fibonacci.vy
[rt] Split the runtime into multiple modules
[ivy] / ivy-examples / fibonacci.vy
1 (let ([nil (lam (c n) (n))]
2 [cons (lam (x y) (lam (c n) (c x y)))]
3 [head true]
4 [fix (lam (f)
5 (let ([t (lam (x) (f (lam (v) (x x v))))])
6 (t t)))]
7 [if (lam (c t f) ((c t f)))])
8 ([fix (lam (recur a b l n)
9 (if (<= n 0)
10 [lam () l]
11 [lam () (recur b (+ (debug a) b) (cons a l) (- n 1))]))]
12 0 1 nil 30))