diff options
| author | Edvard Thörnros <edvard.thornros@gmail.com> | 2021-02-19 18:07:21 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-19 18:07:21 +0100 |
| commit | fe41db5dceecb01a0ada18ea2fc369abb1498aa3 (patch) | |
| tree | 539e63178a3a687bc4df92d53712cd9b028bf0e9 /progs/bench/fib.sy | |
| parent | f024e88de53c24fd5e5e2fb2d66947dc93262af8 (diff) | |
| parent | 7e330b8d622183696ddf3c7f8140c6510804e0a0 (diff) | |
| download | sylt-fe41db5dceecb01a0ada18ea2fc369abb1498aa3.tar.gz | |
Merge branch 'main' into unusued-variables
Diffstat (limited to 'progs/bench/fib.sy')
| -rw-r--r-- | progs/bench/fib.sy | 10 |
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 |
