[plt-scheme] read, read-line

From: Eli Barzilay (eli at barzilay.org)
Date: Fri Jan 13 14:22:06 EST 2006

On Jan 13, Chongkai Zhu wrote:
> I have a program that occasionally needs user input. It 
> use (read) to get a S-exp and (read-line) to get a string.
> In v20x, all things work fine.

I don't see any difference between 20x and 30x in the treatment of

> Now I shift to v30x. After a (read), normally a #\newline 
> will be left on the input-port. So the next (read-line) 
> will get a null string. I can solve by (peek-char) and 
> then (read-char) if it is #\newline. But will it be more 
> reasonable if PLT change the (read) to do this auto-
> matically?

Why?  I would expect `read' to do just what it's supposed to do: read
an s-expression and not eat away any following whitespace, either
newline or space.

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!

Posted on the users mailing list.