mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-05 20:58:01 +00:00
10 lines
224 B
Text
10 lines
224 B
Text
app [main] { pf: platform "fibonacci-platform/main.roc" }
|
|
|
|
main = \n -> fib(n, 0, 1)
|
|
|
|
# the clever implementation requires join points
|
|
fib = \n, a, b ->
|
|
if n == 0 then
|
|
a
|
|
else
|
|
fib((n - 1), b, (a + b))
|