* Added ackerman benchmark
This commit is contained in:
parent
681ec55067
commit
8cd99e6a2e
|
@ -1,6 +1,8 @@
|
||||||
|
|
||||||
(library (r6rs-benchmarks)
|
(library (r6rs-benchmarks)
|
||||||
(export run-benchmark fib-iters)
|
(export run-benchmark
|
||||||
|
ack-iters
|
||||||
|
fib-iters)
|
||||||
(import (ikarus))
|
(import (ikarus))
|
||||||
|
|
||||||
(define (run-bench count run)
|
(define (run-bench count run)
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
;;; ACK -- One of the Kernighan and Van Wyk benchmarks.
|
||||||
|
|
||||||
|
(library (r6rs-benchmarks ack)
|
||||||
|
(export main)
|
||||||
|
(import (r6rs) (r6rs-benchmarks))
|
||||||
|
|
||||||
|
(define (ack m n)
|
||||||
|
(cond ((= m 0) (+ n 1))
|
||||||
|
((= n 0) (ack (- m 1) 1))
|
||||||
|
(else (ack (- m 1) (ack m (- n 1))))))
|
||||||
|
|
||||||
|
(define (main . args)
|
||||||
|
(run-benchmark
|
||||||
|
"ack"
|
||||||
|
ack-iters
|
||||||
|
(lambda (result) (equal? result 4093))
|
||||||
|
(lambda (m n) (lambda () (ack m n)))
|
||||||
|
3
|
||||||
|
9)))
|
Loading…
Reference in New Issue