You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wasm3/test/wasi/mal/test-fib.mal

9 lines
235 B
Plaintext

;; Compute a Fibonacci number with two recursions.
(def! fib
(fn* [n] ; non-negative number
(if (<= n 1)
n
(+ (fib (- n 1)) (fib (- n 2))))))
(println (fib (read-string (first *ARGV*))))