[Openmcl-devel] make-keyword
Taoufik Dachraoui
taoufik.dachraoui at wanadoo.fr
Thu Oct 22 01:32:34 PDT 2009
On Oct 22, 2009, at 10:08 AM, Leslie P. Polzer wrote:
>
>
> Taoufik Dachraoui wrote:
>
>> is there a function make-keyword that takes a symbol s as parameter
>> and
>> returns a keyword k such that (eq (symbol-name s) (symbol-name k))
>> is T
>
> (defun make-keyword (sym)
> (intern (symbol-name sym) :keyword))
>
> --
> http://www.linkedin.com/in/polzer
>
>
I implemented make-keyword using read-from-string, how is this
compared to using intern?
what are the side-effects when used within the macro definition?
(defmacro defviewclass (sym)
(let ((kwd (intern (symbol-name sym) :keyword)))
`(defmacro ,sym (attrs &rest body)
(let ((a `(, at attrs)))
(if (null a)
(setf a '(:class ,kwd))
(setf (getattr :class a) ,kwd))
`(m1 ,a , at body)))))
OR
(defmacro defviewclass (sym)
(let ((kwd (read-from-string (format nil ":~A" sym))))
`(defmacro ,sym (attrs &rest body)
(let ((a `(, at attrs)))
(if (null a)
(setf a '(:class ,kwd))
(setf (getattr :class a) ,kwd))
`(m1 ,a , at body)))))
Taoufik
More information about the Openmcl-devel
mailing list