aboutsummaryrefslogtreecommitdiffstats
path: root/progs/bench/fib.sy
diff options
context:
space:
mode:
authorEdvard Thörnros <edvard.thornros@gmail.com>2021-02-19 17:25:00 +0100
committerGitHub <noreply@github.com>2021-02-19 17:25:00 +0100
commit66aa179230b759a57ad7db0a6b70c4d9930acb80 (patch)
treef8fd2501313a02d72c8a2e1981bb19e6827fc34e /progs/bench/fib.sy
parente352b43ee321a181b537c2c1070e50ac7cf45453 (diff)
parent367d7b32a2825f6e4c8ef3b5423ceb1cd2b62bd0 (diff)
downloadsylt-66aa179230b759a57ad7db0a6b70c4d9930acb80.tar.gz
Merge pull request #74 from FredTheDino/test-suite
test suite
Diffstat (limited to 'progs/bench/fib.sy')
-rw-r--r--progs/bench/fib.sy10
1 files changed, 10 insertions, 0 deletions
diff --git a/progs/bench/fib.sy b/progs/bench/fib.sy
new file mode 100644
index 0000000..de68f5c
--- /dev/null
+++ b/progs/bench/fib.sy
@@ -0,0 +1,10 @@
+// The worst implementation of Fibonacci calculations
+// possible. FYI, it can be done in constant time.
+fib :: fn a:int -> int {
+ if a < 2 {
+ ret a
+ }
+ ret fib(a - 1) + fib(a - 2)
+}
+// 23 is around where things start getting slow.
+fib(23) <=> 28657