Skip to content

Instantly share code, notes, and snippets.

@eriksvedang
Last active April 22, 2022 21:27
Show Gist options
  • Select an option

  • Save eriksvedang/3a1c31e5477c96ffb0f36964b2f67bf5 to your computer and use it in GitHub Desktop.

Select an option

Save eriksvedang/3a1c31e5477c96ffb0f36964b2f67bf5 to your computer and use it in GitHub Desktop.
(define (fib n)
(if (< n 2)
1
(+ (fib (- n 2))
(fib (- n 1)))))
(define (range from to)
(if (= from to)
(list to)
(cons from (range (+ from 1) to))))
(display (map fib (range 0 40)))
(display "\n")
(exit)
RESULTS:
chibi-scheme 37.78s user 0.22s system 98% cpu 38.704 total
guile 8.24s user 0.03s system 100% cpu 8.273 total
s7 4.41s user 0.01s system 99% cpu 4.849 total
chez 2.73s user 0.03s system 98% cpu 2.792 total
---
(defndynamic fib [n]
(if (< n 2)
1
(+ (fib (- n 2))
(fib (- n 1)))))
(macro-log (fib 28)) ;; <- OBS!!!
(quit)
RESULTS:
carp fib.carp 27.53s user 3.44s system 210% cpu 14.746 total
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment