What is the best way to perform actions after a sequence terminates? Here is
a simple example that is like in-lines, but takes a path instead of a port.
It works, but I was wondering if there is a better way to do it.
(define (in-file-lines path)
(let ((port (open-input-file path #:mode 'text)))
(make-do-sequence
(lambda ()
(values
(lambda (_) (read-line port 'any))
void
(void)
void
(lambda _ (if (eof-object? (peek-byte port))
(begin
(close-input-port port)
#f)
#t))
void)))))
Thanks,
Doug
_________________________________________________
For list-related administrative tasks:
http://lists.racket-lang.org/listinfo/dev