[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
read-cstream fix
- To: scheme@mit-mc.ARPA
- Subject: read-cstream fix
- From: John D. Ramsdell <linus!ramsdell@mitre-bedford.ARPA>
- Date: Mon ,18 Nov 85 08:39:48 EDT
- Organization: The MITRE Corp., Bedford, MA
- Posted-date: Mon, 18 Nov 85 07:39:48 est
; read-cstream that checks for EOF.
(define (read-cstream port)
(lambda (c)
(let ((element (read port)))
(if (eof-object? element)
(ecs c) ; close port?
(c element (read-cstream port))))))
I sent out some undebuged code for read-cstream.
The above version does the correct thing for EOF.
In some applications it may be desirable to delay
the reading of the port.
(define (read-cstream port)
(let ((element (delay (read port))))
(lambda (c)
(if (eof-object? (force element))
(ecs c)
(c (force element) (read-cstream port))))))
John