[racket] Call racket with long code from racket

From: Noel Welsh (noelwelsh at gmail.com)
Date: Tue Sep 13 08:03:51 EDT 2011

That is not one expression, but several. Wrap it in a (begin ...) and
it should work. I.e.

  (display (port->string (car (process    (format  "racket -e \" ~a \" "
                                                "
                                                (begin
                                                (require mzlib/defmacro)
                                                (define-macro (my-when
 test . body)`(if ,test (begin , at body) '() ))
                                 (my-when #t '(5 6 7))
                                                "
                                                ))))))

HTH,
N.

On Tue, Sep 13, 2011 at 12:22 PM, Niitsuma Hirotaka
<hirotaka.niitsuma at gmail.com> wrote:
>> You could try something like this:
>> #lang racket
>> (require racket/system)
>> (display (port->string (car (process (format "racket -e '~a' " '(+ 2 3))))))
>
> That does not work in the following case
>
>  (display (port->string (car (process    (format  "racket -e \" ~a \" "
>                                                "
>                                                (require mzlib/defmacro)
>                                                (define-macro (my-when
> test . body)`(if ,test (begin , at body) '() ))
>                                 (my-when #t '(5 6 7))
>                                                "
>                                                )))))
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>



Posted on the users mailing list.