aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/fib.lyn12
1 files changed, 12 insertions, 0 deletions
diff --git a/examples/fib.lyn b/examples/fib.lyn
new file mode 100644
index 0000000..b24f18b
--- /dev/null
+++ b/examples/fib.lyn
@@ -0,0 +1,12 @@
+define (fib n) {
+ if (< n 2) {
+ get 1
+ } {
+ define f1 (fib (- n 1))
+ define f2 (fib (- n 2))
+ + f1 f2
+ }
+}
+
+display (fib 42)
+newline