File tree Expand file tree Collapse file tree 2 files changed +16
-8
lines changed
Expand file tree Collapse file tree 2 files changed +16
-8
lines changed Original file line number Diff line number Diff line change 55;; Interpret p with given string as input,
66;; return value and collected output as string
77(define (interp/io p input)
8- (parameterize ((current-output-port (open-output-string))
9- (current-input-port (open-input-string input)))
10- (cons (interp p)
11- (get-output-string (current-output-port)))))
8+ (define result (box #f ))
9+ (define output
10+ (with-input-from-string input
11+ (λ ()
12+ (with-output-to-string
13+ (λ ()
14+ (set-box! result (interp p)))))))
15+ (cons (unbox result) output))
1216
Original file line number Diff line number Diff line change 55;; Interpret p with given string as input,
66;; return value and collected output as string
77(define (interp/io p input)
8- (parameterize ((current-output-port (open-output-string))
9- (current-input-port (open-input-string input)))
10- (cons (interp p)
11- (get-output-string (current-output-port)))))
8+ (define result (box #f ))
9+ (define output
10+ (with-input-from-string input
11+ (λ ()
12+ (with-output-to-string
13+ (λ ()
14+ (set-box! result (interp p)))))))
15+ (cons (unbox result) output))
1216
You can’t perform that action at this time.
0 commit comments