diff options
Diffstat (limited to 'examples/fib.fwd')
-rw-r--r-- | examples/fib.fwd | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/examples/fib.fwd b/examples/fib.fwd index be2b63f..e5014af 100644 --- a/examples/fib.fwd +++ b/examples/fib.fwd @@ -5,17 +5,19 @@ fib(int n, (int) res) { - if n < 2 { + fwd_copy(n) => int n1, int n2; + if n1 < 2 { res(1); } else { - fib(n - 1) => int f1; - fib(n - 2) => int f2; + fib(n2 - 1) => int f1; + fib(n2 - 2) => int f2; res(f1 + f2); } } /* 'extern' println */ -fwd_println(int n); +fwd_println(auto n); +fwd_copy(auto n, (auto, auto) n1); main() { |