[Openmcl-devel] make-keyword
Taoufik Dachraoui
taoufik.dachraoui at wanadoo.fr
Thu Oct 22 01:03:02 PDT 2009
On Oct 22, 2009, at 9:47 AM, Taoufik Dachraoui wrote:
> Hi
>
> I am trying to define the following macro (that defines macros)
>
> (defmacro defviewclass (sym)
> (let ((kwd (make-keyword 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)))))
>
> 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
>
> Taoufik
>
I found the following:
(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)))))
Is there any issues in using read-from-string?
Taoufik
More information about the Openmcl-devel
mailing list