picrin/etc/tak.scm

22 lines
343 B
Scheme
Raw Normal View History

2013-10-28 09:08:57 -04:00
(define (time f)
2013-11-04 13:19:04 -05:00
(let ((start (current-jiffy)))
(f)
(/ (- (current-jiffy) start)
(jiffies-per-second))))
2013-10-28 09:08:57 -04:00
(define (tak x y z)
(if (> x y)
2013-11-04 13:19:04 -05:00
(tak (tak (- x 1) y z)
2013-10-28 09:08:57 -04:00
(tak (- y 1) z x)
(tak (- z 1) x y))
y))
(define (f)
(tak 12 6 0))
(write (time f))
2013-11-04 13:19:04 -05:00
(newline)
2013-11-04 20:37:51 -05:00
; 70fb34 -> 10.374959
; fb6679 -> 4.275342