fixing bug in with-input-from-file

This commit is contained in:
JeffBezanson 2009-08-09 18:27:05 +00:00
parent 929ec92a65
commit b59dcdc877
3 changed files with 5 additions and 2 deletions

View File

@ -135,7 +135,7 @@
(define (with-input-from-file name thunk) (define (with-input-from-file name thunk)
(let ((f (file name :read))) (let ((f (file name :read)))
(unwind-protect (unwind-protect
(with-output-to f (thunk)) (with-input-from f (thunk))
(io.close f)))) (io.close f))))
(define (call-with-input-file name proc) (define (call-with-input-file name proc)

File diff suppressed because one or more lines are too long

View File

@ -552,6 +552,9 @@
(define-macro (with-output-to stream . body) (define-macro (with-output-to stream . body)
`(with-bindings ((*output-stream* ,stream)) `(with-bindings ((*output-stream* ,stream))
,@body)) ,@body))
(define-macro (with-input-from stream . body)
`(with-bindings ((*input-stream* ,stream))
,@body))
; vector functions ------------------------------------------------------------ ; vector functions ------------------------------------------------------------