home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.lisp
- Path: sparky!uunet!noc.near.net!news.Brown.EDU!qt.cs.utexas.edu!cs.utexas.edu!sdd.hp.com!ux1.cso.uiuc.edu!m.cs.uiuc.edu!demagog!barbehen
- From: barbehen@demagog.cs.uiuc.edu (Michael Barbehenn)
- Subject: Re: Selective compilation of reader macro forms...
- Message-ID: <1992Sep8.022544.28491@m.cs.uiuc.edu>
- Sender: news@m.cs.uiuc.edu (News Database (admin-Mike Schwager))
- Organization: University of Illinois, Dept. of Comp. Sci., Urbana, IL
- References: <60132@mimsy.umd.edu>
- Date: Tue, 8 Sep 1992 02:25:44 GMT
- Lines: 24
-
- waander@cs.umd.edu (Bill Andersen) writes:
-
- > I have a reader macro which I want to do two different things depending on
- >whether the form following the macro is being compiled, or is being
- >entered interactively. The best way to show this is with an example:
- >
- >I want to be able to compile a function referencing #$Foo
- >without having to worry about an error if "Foo" is not in
- >*table* during compilation. I just want a call to
- >(lookup "Foo") compiled into the function.
-
-
- Here's some code that has the flavor of what you are asking for:
-
- (defun LOOKUP (name)
- (or (gethash name *table*)
- (error "Sorry, ~s is not in *table*" name)))
-
- (defun READ-THING (stream char)
- `(lookup ',(read stream t nil t)))
-
- (set-macro-character #\? #'read-thing)
-
-
-