[plt-scheme] Re: Doc for "standard peek-char"

From: SpinyNorman (jmcaxolotl at gmail.com)
Date: Thu May 17 10:11:33 EDT 2007

Right.  I'm in some kind of warp in the space-time continuum, because
the Index now takes me right there, whereas it didn't a minute ago.  I
have to stop hitching rides on UFO's.

And I agree, I should have known better than  to use "=".

Thanks.



On May 17, 9:51 am, Jens Axel Søgaard <jensa... at soegaard.net> wrote:
> SpinyNorman skrev:
>
> > In the MzScheme manual, in Ch11, peek-char is described thus:
>
> > (peek-char [input-port skip-k]) extends the standard peek-char with an
> > optional argument (defaulting to 0) that represents the number of
> > bytes (not characters) to skip.
>
> > OK, um, where is the *standard* peek-char described?
>
> In R5RS.
>
> http://download.plt-scheme.org/doc/360/html/r5rs/r5rs-Z-H-9.html#%_id...
>
> > I'm trying to find out what peek-byte (which is defined by reference
> > to peek-char) returns at eof.
>
> It is returning the end-of-file-object.
>
> > Actually, that's easy to determine
> > empirically, but what DrScheme prints, "#<eof>" is not something I can
> > test for -- it's a syntax error to write
>
> Which is printed as #<eof>.
>
> > (= "#<eof>" (peek-byte port))
>
> The test is:
>
>    (eof-object? (peek-byte port))
>
> > I understand that I most likely need to use something other than "="
> > as well, because I care about equivalence rather than identity.
>
> Note that = only works on numbers.
>
> --
> Jens Axel Søgaard
>
> _________________________________________________
>   For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the users mailing list.