read-line should handle carriage return as an end of line

Issue #33 resolved
Takashi Kato repo owner created an issue

R7RS says;

For the purpose of this procedure, an end of line consists of either a
linefeed character, a carriage return character, or a sequence of a carriage
return character followed by a linefeed character

So this should read string without carriage return.

(import (scheme base) (scheme file))
(let* ((p (open-input-string "okokok\r\nblerg\r\n"))
       (line0 (read-line p))
       (line1 (read-line p)))
     (write line0) (newline)
     (write line1) (newline))

Comments (1)

  1. Log in to comment