[plt-scheme] Interactive input

From: Eli Barzilay (eli at barzilay.org)
Date: Thu Jan 19 09:04:17 EST 2006

On Jan 19, Gregory Woodhouse wrote:
> I realize this is a basic question, but...
> 
> In a naive attempt to write a function that could either accept  
> interactive (keyboard) input or read from a file, I tried writing a  
> loop that repeatedly called read-line and then tested to see if the  
> value was eof-object. In retrospect, it's not terribly surprising  
> that it didn't work (presumably, the return value was eof-object when  
> no input was ready), but what is the alternative? I can try reading  
> input a character at a time, repeatedly using peek-char, but that  
> seems ugly and cumbersome. I can write a special reader for input  
> that comes from the keyboard, a telnet session, or a similar source,  
> and a different one for files on disk, but is that necessary? The  
> input will be program text, but not (necessarily) Scheme or Lisp and  
> I cannot assume that the input will be in the form of S-expressions.

Search for "-avail" functions in help-desk.

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


Posted on the users mailing list.