[parenscript-devel] macro

Haris Bogdanovich fbogdanovic at xnet.hr
Fri Apr 22 09:25:30 UTC 2011


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 





More information about the parenscript-devel mailing list