Created
August 20, 2013 11:41
-
-
Save SaitoAtsushi/6280350 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: src/parsing.sch | |
=================================================================== | |
--- src/parsing.sch (リビジョン 6659) | |
+++ src/parsing.sch (作業コピー) | |
@@ -29,14 +29,31 @@ | |
; n defaults to 1000, and input defaults to "nboyer.sch". | |
; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
- | |
-(import (rnrs base) | |
- (rnrs unicode) | |
- (rnrs lists) | |
- (rnrs control) | |
- (rnrs io simple) | |
- (rnrs mutable-strings)) | |
+(define (hide r x) | |
+ (call-with-values | |
+ (lambda () | |
+ (values (vector values (lambda (x) x)) | |
+ (if (< r 100) 0 1))) | |
+ (lambda (v i) | |
+ ((vector-ref v i) x)))) | |
+ | |
+(define (run-r6rs-benchmark name count thunk ok?) | |
+ (display "Running ") | |
+ (display name) | |
+ (newline) | |
+ (let loop ((i 0) | |
+ (result (if #f #f))) | |
+ (cond ((< i count) | |
+ (loop (+ i 1) (thunk))) | |
+ ((ok? result) | |
+ result) | |
+ (else | |
+ (display "ERROR: returned incorrect result: ") | |
+ (write result) | |
+ (newline) | |
+ result)))) | |
+ | |
(define (parsing-benchmark . rest) | |
(let* ((n (if (null? rest) 1000 (car rest))) | |
(input (if (or (null? rest) (null? (cdr rest))) | |
@@ -928,7 +945,7 @@ | |
((eq? x 'eof) | |
y)))) | |
-(define (main) | |
+(define (main args) | |
(let* ((count (read)) | |
(input1 (read)) | |
(output (read)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment