| 1 |
;;; CAT -- One of the Kernighan and Van Wyk benchmarks. |
| 2 |
|
| 3 |
(define inport #f) |
| 4 |
(define outport #f) |
| 5 |
|
| 6 |
(define (catport port) |
| 7 |
(let ((x (read-char port))) |
| 8 |
(if (eof-object? x) |
| 9 |
(close-output-port outport) |
| 10 |
(begin |
| 11 |
(write-char x outport) |
| 12 |
(catport port))))) |
| 13 |
|
| 14 |
(define (go) |
| 15 |
(set! inport (open-input-file "../../src/bib")) |
| 16 |
(set! outport (open-output-file "foo")) |
| 17 |
(catport inport) |
| 18 |
(close-input-port inport)) |
| 19 |
|
| 20 |
(define (main . args) |
| 21 |
(run-benchmark |
| 22 |
"cat" |
| 23 |
cat-iters |
| 24 |
(lambda (result) #t) |
| 25 |
(lambda () (lambda () (go))))) |