| 1 |
;;; DIVREC -- Benchmark which divides by 2 using lists of n ()'s. |
| 2 |
|
| 3 |
(define (create-n n) |
| 4 |
(do ((n n (- n 1)) |
| 5 |
(a '() (cons '() a))) |
| 6 |
((= n 0) a))) |
| 7 |
|
| 8 |
(define *ll* (create-n 200)) |
| 9 |
|
| 10 |
(define (recursive-div2 l) |
| 11 |
(cond ((null? l) '()) |
| 12 |
(else (cons (car l) (recursive-div2 (cddr l)))))) |
| 13 |
|
| 14 |
(define (main . args) |
| 15 |
(run-benchmark |
| 16 |
"divrec" |
| 17 |
divrec-iters |
| 18 |
(lambda (result) |
| 19 |
(equal? result |
| 20 |
'(() () () () () () () () () () () () () () () () () () () () |
| 21 |
() () () () () () () () () () () () () () () () () () () () |
| 22 |
() () () () () () () () () () () () () () () () () () () () |
| 23 |
() () () () () () () () () () () () () () () () () () () () |
| 24 |
() () () () () () () () () () () () () () () () () () () ()))) |
| 25 |
(lambda (l) (lambda () (recursive-div2 l))) |
| 26 |
*ll*)) |