ikarus/benchmarks/new/r6rs-benchmarks/tak.ss

24 lines
486 B
Scheme
Raw Normal View History

2007-06-13 10:49:54 -04:00
;;; TAK -- A vanilla version of the TAKeuchi function.
(library (r6rs-benchmarks tak)
(export main)
(import (r6rs) (r6rs-benchmarks))
(define (tak x y z)
(if (not (< y x))
z
(tak (tak (- x 1) y z)
(tak (- y 1) z x)
(tak (- z 1) x y))))
(define (main . args)
(run-benchmark
"tak"
tak-iters
(lambda (result) (equal? result 7))
(lambda (x y z) (lambda () (tak x y z)))
18
12
6)))