Re: [racket-users] telling apart files ending with a newline

2020-07-30 Thread Ryan Culpepper
If I understand the docs correctly, the OS-specific handling is in open-input-file, but it is not the default. Here is an alternative to read-line that preserves line endings: #lang racket/base ;; my-read-line : InputPort -> String ;; Like read-line, but preserves line ending. ;; Fails

[racket-users] telling apart files ending with a newline

2020-07-29 Thread Shriram Krishnamurthi
Suppose I have two files that are identical, except one ends in a newline and the other does not. If I use `read-line` to read the successive lines of this file, because it swallows the line separators, there is no way to tell them apart. E.g., these two strings "a b" and "a b " read using