ludus/hello.ld

18 lines
256 B
Plaintext
Raw Normal View History

2022-04-28 23:27:59 +00:00
fn fib (n) -> if eq (n, 0)
then 1
else if eq (n, 1)
then 1
else add (fib (sub (n, 1)), fib (sub (n, 2)))
2022-04-25 23:08:24 +00:00
2022-04-26 00:37:52 +00:00
fn fact {
(n) -> fact (n, 1)
(1, acc) -> acc
(n, acc) -> fact (sub (n, 1), mult (n, acc))
}
ns Recursive {
fact
fib
}
2022-04-28 23:27:59 +00:00
Recursive :fib (25)