~jojo/Carth

ref: b144030d9a5428cf4472e3c55258d8983c20982d Carth/test/tests/good/fibonacci.carth -rw-r--r-- 217 bytes
b144030dJoJo Make main IO Unit, i.e. (Fun RealWorld [Unit RealWorld]) 1 year, 2 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
;; 7540113804746346429

(import std)

(define (main real-world)
  (display (show-int (fib 92)) real-world))

(define fib
  (define (fib' a b n)
    (if (= n 0)
        a
      (fib' b (+ a b) (dec n))))
  (fib' 0 1))