main.scm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
(define (fib n)
  (cond 
    ((< n 2) n)
    (else (+ (fib (- n 1)) (fib (- n 2))))
  )
)

(define (time f . args)
  (define before (js-invoke (js-new "Date") "getTime"))
  (apply f args)
  (define after (js-invoke (js-new "Date") "getTime"))
  (print "Ran for " (- after before) " ms")
)

(time fib 1)
(time fib 2)
(time fib 4)
(time fib 8)
(time fib 16)
BiwaScheme Interpreter version 0.6.4 Copyright (C) 2007-2014 Yutaka HARA and the BiwaScheme team