ikarus/benchmarks/rnrs-benchmarks/fib.ss

21 lines
414 B
Scheme
Raw Normal View History

2007-06-13 03:14:14 -04:00
;;; FIB -- A classic benchmark, computes fib(35) inefficiently.
(library (rnrs-benchmarks fib)
2007-06-13 03:14:14 -04:00
(export main)
(import (rnrs) (rnrs-benchmarks))
2007-06-13 03:14:14 -04:00
(define (fib n)
(if (< n 2)
n
(+ (fib (- n 1))
(fib (- n 2)))))
(define (main . args)
(run-benchmark
"fib"
fib-iters
(lambda (result) (equal? result 9227465))
(lambda (n) (lambda () (fib n)))
35)))