diff options
Diffstat (limited to 'examples/fib.fwd')
| -rw-r--r-- | examples/fib.fwd | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/examples/fib.fwd b/examples/fib.fwd deleted file mode 100644 index 4583a26..0000000 --- a/examples/fib.fwd +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Currently the compilation process requires a bit of manual intervention. - * For this particular example, run something like this from the root dir: - * - * ./fwd examples/fib.fwd > /tmp/fib.c - * gcc -Lmod -Iinclude -Ilib -Wl,-rpath=mod -O2 /tmp/fib.c -lfwdio -o /tmp/fib - * /tmp/fib - * - */ - -/* modules are just libraries that can be loaded at runtime */ -import "../mod/libfwdio.so" - -fib(i64 n, (i64) res) -{ - if n < 2 { - res(1); - } else { - fib(n - 1) => i64 f1; - fib(n - 2) => i64 f2; - res(f1 + f2); - } -} - -main() -{ - fib(42) => i64 n; - fwdprint_i64(n); - fwdprint_nl(); -} |
