[parenscript-devel] Conditional nesting of lisp and javascript code

Slobodan Milnović slobodan.milnovic at gmail.com
Wed Jun 1 17:12:22 UTC 2011


2011/5/16 Theam Yong Chew <senatorzergling at gmail.com>:
> I can only think of this alternative:
>
> (defpsmacro conditional-splice (test &body body)
>  (when test
>    `(progn , at body)))

Hi,

I've tried to expand on this, but it seems that I'm missing some basic
knowledge of lisp and parenscript macros. If I try something like
this:

(ps:defpsmacro conditional-splice (cond1 cond2 &body body)
   (when (<= cond1 cond2)
      `(progn , at body)))

(defvar first 2)
(defvar second 3)

So, when I do this

(ps:ps (conditional-splice 2 3 4))

I get an ok response
"4;"

but, when I do this

(ps:ps (conditional-splice first second 4))

then I get an error
"The value FIRST is not of type REAL."

Well, I've tried with

(ps:ps (conditional-splice (ps:lisp first) (ps:lisp second) 4))

but I'm getting the same error.

So, what I'm missing is understanding in how to translate the value of
the lisp variable into generated parenscript code. I've tried
understanding parenscript documentation, but my guess is that this is
something considered trivial knowledge when lisp/parenscript macros
are involved (which I currently don't have).

Could anyone be so kind to point me to relevant documentation or try
to give me an explanation of my error?




More information about the parenscript-devel mailing list