Subject: Re: case and quoted keys - a misunderstanding
From: rpw3@rpw3.org (Rob Warnock)
Date: Fri, 18 Jul 2003 03:43:12 -0500
Newsgroups: comp.lang.lisp
Message-ID: <9sucnYYoE-29LoqiXTWc-g@speakeasy.net>
Wade Humeniuk <wade@nospam.nowhere> wrote:
+---------------
| "Frode Vatvedt Fjeld" <frodef@cs.uit.no>:
| >   (defun read-to-char (c stream)
| >     (loop for x = (read-char stream nil)
| >        while x do (when (char= x c) (return t))))
| > 
| > So there, I think we have now listed almost every possible
| > implementation of this function. Take your pick.
| 
| (defun read-to-char (c stream)
|   (when (peek-char c stream nil nil)
|     (read-char stream)))
+---------------

Yup! That's what I finally settled on as well for a "#!"-ignoring
reader macro ("#!" starts Unix shell scripts):

	(set-dispatch-macro-character #\# #\!
	  (lambda (s c p)
	    (declare (ignore c p))
	    (peek-char #\newline s t nil t) ; doesn't cons like read-line
	    (read-char s t nil t)
	    (values)))

[Hmmm... Didn't we just have a thread about occasionally reimplementing
advanced features because you don't remember them all?  ;-}  ;-}  ]


-Rob

-----
Rob Warnock, PP-ASEL-IA		<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607