There is also the 'lisp macro which can be used from inside a Parenscript expression:
 
(ps:ps (setf y (lisp (* 2 2))))
=> "y = 4;"
 
This allows your example to work if we declare x special:
 
(let ((x 1))
  (declare (special x))
  (ps:ps (setf y (lisp x))))
=> "y = 1;"
 
But it doesn't pick up the lexical environment:
 
(let ((x 1))
  (ps:ps (setf y (lisp x))))
  => [Condition of type UNBOUND-VARIABLE]
 
This is true even when PS is the current package. Can anyone (Vladimir?) explain whether it has to be this way? Or could PS be extended to pick up lexical bindings as well?
 
Daniel
 
 
 
 

 
On Mon, Mar 17, 2008 at 4:25 PM, Simon Cusack <scusack@fastmail.com.au> wrote:
Hi Wout,

On Mon, 17 Mar 2008 23:56:34 +0000
Wout Perquin <hedres@skynet.be> wrote:

> Hi,
> I am looking for examples that show how lisp data can be passed to ps
> scripts.  E.g. :
> I would like that
> (let ((x 1))
>   (ps:ps (setf y x)))
> is translated into :
> "y = 1;"
> in other words, how do I refer from within a parenscript construct to
> the lisp environment to collect a value ?
> Many thanks,
> -Wout

I use ps:ps* like so;

(let ((x 1))
 (ps:ps* `(setf y ,x)))

- sim
_______________________________________________
parenscript-devel mailing list
parenscript-devel@common-lisp.net
http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel