[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

read-cstream fix

; 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))))))