Skip to content

Instantly share code, notes, and snippets.


rootmos/fib.scm Secret

Created Jun 6, 2017
What would you like to do?
(import (rnrs))
(define fib
(lambda (n)
((eq? 1 n) 1)
((eq? 2 n) 1)
(else (+ (fib (- n 1)) (fib (- n 2)))))))
(display (fib 45))
; > /usr/bin/time scheme --script fib.scm
; 7.39user 0.01system 0:07.40elapsed 99%CPU (0avgtext+0avgdata 39180maxresident)k
; 0inputs+0outputs (0major+9387minor)pagefaults 0swaps
; > /usr/bin/time scheme --program fib.scm > /dev/null
; 5.92user 0.02system 0:05.95elapsed 99%CPU (0avgtext+0avgdata 39432maxresident)k
; 0inputs+0outputs (0major+8927minor)pagefaults 0swaps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment