Welcome to the CHICKEN Scheme pasting service

strm close exn ex added by kon on Wed Jul 12 01:47:49 2023

(define (read-file-stream filename)
  (let ([f (open-input-file filename)]
        (exn #f))
    (let read-loop ()
      (define line
        (handle-exceptions rdexn
          (begin 
            (set! exn rdexn) ;save what happened
            #!eof)           ;ensure file closed
          (read-line f)))
      (print "read line")
      (if (eof-object? line)
        (begin
          (close-input-port f)
          ;NOTE do something w/ exn
          stream-null)
        (stream-cons line (read-loop))))))

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
Which procedure can be used to check whether its argument is a string?
Visually impaired? Let me spell it for you (wav file) download WAV