error in unread-char
Hello all, I think I've found some behavior in unread-char which doesn't match the spec (which is a pity, because in this case I found the actual behavor rather useful). Consider the following (with-input-from-string (s "abcdefg") (read-char s) (read-char s) (unread-char #\b s) (unread-char #\a s) (read-char s)) In LispWorks: => #\a In CLISP: => *** - UNREAD-CHAR from #<INPUT STRING-INPUT-STREAM> without READ-CHAR before it and the docs state "It is an error to invoke unread-char twice consecutively on the same stream without an intervening call to read-char (or some other input operation which implicitly reads characters) on that stream." of which I must admit, this is a case. Also of note (which I just discovered), it doesn't seem to matter whether or not the arg to unread char was actually the last unread char. And, there seem to be two distinct behaviors in LW. (with-input-from-string (s "abcdefg") (read-char s) (read-char s) (unread-char #\x s) ;; not #\b (unread-char #\k s) ;; not #\a (read-char s)) => #\a ;; magic ! However, in a listener, I seem to be able to unread whatever I want. E.g. CL-USER 12 > (unread-char #\h) #\h CL-USER 13 > h ;; I didn't insert this h Any thoughts? I'm on LWM 445, Mac OS X 10.4.2 -- ===================== Joshua Taylor tayloj@rpi.edu