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

24 lines
486 B
Scheme

;;; 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)))