[parenscript-devel] macro

Vladimir Sedach vsedach at gmail.com
Tue Apr 26 16:11:27 UTC 2011


You can use DEFMACRO in Parenscript code (in PS/PS*), or DEFPSMACRO in
Lisp code, plus a few others to define and share macros between CL and
Parenscript. There's further descriptions in the reference manual:

http://common-lisp.net/project/parenscript/reference.html#section-macros

Vladimir

On Fri, Apr 22, 2011 at 5:25 AM, Haris Bogdanovich <fbogdanovic at xnet.hr> wrote:
> Hi.
>
> How to define a macro to give me this code:
>
> (defun xhr-func ()
>     (setf (@ xhr onreadystatechange) (lambda ()
>                                        (if (= (@ xhr ready-state) 4)
>                                          (progn
>                                            (setf ime (@ xhr response-text))
>                                            (alert ime)))
>                                        0))
>     (chain xhr (open "GET" "/value.lisp" true))
>     (chain xhr (send null)))
>
> I tried:
>
> (defmacro xhr-macro ()
>  `(defun xhr-func ()
>     (setf (@ xhr onreadystatechange) (lambda ()
>                                        (if (= (@ xhr ready-state) 4)
>                                          (progn
>                                            (setf ime (@ xhr response-text))
>                                            (alert ime)))
>                                        0))
>     (chain xhr (open "GET" "/value.lisp" true))
>     (chain xhr (send null))))
>
> Lispworks inserts lots of its code when trying macroexpand
> so it doesn't work.
> I would latter give arguments to the macro, ofcourse.
> What are defmacro/ps and defmacro+ps for ?
>
> Thanks
>
>
> _______________________________________________
> parenscript-devel mailing list
> parenscript-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
>




More information about the parenscript-devel mailing list