[plt-scheme] why does input port close?
I don't understand the behavior of the following program:
(define (input-port->line-stream in)
(letrec ([next-line (lambda ()
(let ([line (read-line in)])
(if (eof-object? line)
null
(cons line next-line))))])
next-line))
(define a (input-port->line-stream (current-input-port)))
(a)
(define b (call-with-input-file "/home/dbtucker/A.hs" input-port->line-stream))
(b)
The call to (a) succeeds, but the call to (b) gives this error:
read-char: input port is closed
Why is that? Thanks,
Dave