bug in macro handling?
"dlispym" <[email protected]> Sat, 12 Apr 2003 14:43:35 -0000
| Newsgroups | gmane.lisp.corman |
|---|---|
| Message-ID | <[email protected]> |
Hello.
I'm trying to run a query compiler example from Paul Graham's
"On Lisp" in CormanLisp. Here's the interaction transcript:
(defun make-db (&optional (size 100))
(make-hash-table :size size))
=>MAKE-DB
(defvar *default-db* (make-db))
=>*DEFAULT-DB*
(defun clear-db (&optional (db *default-db*))
(clrhash db))
=>CLEAR-DB
(defmacro db-query (key &optional (db '*default-db*))
`(gethash ,key ,db))
=>DB-QUERY
(defun db-push (key val &optional (db *default-db*))
(push val (db-query key db)))
=>;;; Warning: Function not defined: NIL
DB-PUSH
(defmacro fact (pred &rest args)
`(progn (db-push ',pred ',args)
',args))
=>FACT
(fact lisp cormanlisp)
=>
...
;;; An error occurred in function DB-PUSH:
;;; Error: The function NIL is undefined
...
(push '(cormanlisp) (db-query 'lisp))
=>...
;;; An error occurred in function #< COMPILED-FUNCTION: #x120D7D0 >:
;;; Error: The function NIL is undefined
...
(push '(cormanlisp) (gethash 'lisp *default-db*))
=>((CORMANLISP))
(macroexpand '(db-query 'lisp))
=>(GETHASH 'LISP *DEFAULT-DB*)
T
The same code works without any problem in Allegro.
Does anyone have an idea what's going on?
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get 128 Bit SSL Encryption!
http://us.click.yahoo.com/xaxhjB/hdqFAA/VygGAA/SyjtlB/TM
---------------------------------------------------------------------~->
To unsubscribe from this group, send an email to:
[email protected]
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/