[racket] How can I unsplice a list of expression into code?

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Sat Nov 17 08:36:07 EST 2012

You could just call lst with num as a parameter. Or you might be looking for define-syntax not define. Is that possible? 


On Nov 17, 2012, at 1:05 AM, Monica Tomson wrote:

> Hi,
> 
> I have an experiment for my project, basically, I need to embedded some s-expression into the code and make it run, like this,
> 
> (define (test lst)
>     (define num 1)
>     (define l (list))
>     `@lst) ; oh, this is not the right way to go.
> 
>   (define lst
>     `( (define num2 (add1 num))
>       (displayln num2)))
> I want the test function be like after test(lst) in racket code:
> 
> (define (test lst)
>     (define num 1)
>     (define l (list))
>     (define num2 (add1 num)
>     (displayln num2))
> How can I do this in racket?
> 
> Thanks,
> 
> --Monica
> 
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20121117/cfab0f05/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4373 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20121117/cfab0f05/attachment-0001.p7s>

Posted on the users mailing list.