Earlier I found a clisp bug when I tried to do this:
> (progn (write (read-preserving-whitespace *standard-input* t nil)) (write 
> (peek-char)) (princ " ") (write (read-preserving-whitespace *standard-input* 
> t nil)) (values))

I think I've found a workaround!!  Basically, force-provide peek-char with TWO 
parameters, whether you need them or not.  Details below.  Comments welcome.

--- David A. Wheeler

===== DETAILS ===============

In clisp, if I pass two parameters to peek-char (the first being nil, the 
second being the input stream), it works well. Thus, running:
(progn (write (read-preserving-whitespace *standard-input* t nil)) (write 
(peek-char nil *standard-input*)) (princ " ") (write 
(read-preserving-whitespace *standard-input* t nil)) (values))

And providing this as input:
x56 t89

Produces the expected output:
X56#\Space T89

Of course, this shouldn't happen.  According to the Common Lisp hyperspec:
  http://www.lispworks.com/documentation/HyperSpec/Body/f_peek_c.htm#peek-char
nil is the default value of the peek-char first parameter (peek-type).
It doesn't even work if you only provide that parameter.  But it works if you 
*also* provide
the stream.

That's a nasty bug, but the workaround seems to work and is portable.



------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
Readable-discuss mailing list
Readable-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/readable-discuss

Reply via email to