<div dir="ltr">Hello<div><br></div><div style>I am trying to port TryClojure (<a href="https://github.com/Raynes/tryclojure">https://github.com/Raynes/tryclojure</a>), a web-based REPL, to Racket.</div><div style><br>I would like the tutorial part to be based on Racket&#39;s &#39;Quick&#39; tutorial (<a href="http://docs.racket-lang.org/quick/">http://docs.racket-lang.org/quick/</a>)<br>
</div><div style><br></div><div style>To do that, I need to evaluate pict expressions, like (circle 10), to a string I can return to the browser for rendering.</div><div style><div><br></div><div style>Right now, I evaluate the strings coming from the browser with the following code:</div>
<div style><br></div><div style><div>;;--------------------------------</div><div><br></div></div><div style><div><div>(define evaluator</div><div>    (parameterize ([sandbox-output &#39;string]</div><div>                          [sandbox-error-output &#39;string] ...)</div>
<div>      (call-with-limits #f #f</div><div>                        (lambda () (make-evaluator &#39;slideshow)))))</div></div><div><br></div><div><br></div><div>(define (run-code ev str)</div><div>  (define res (ev str))</div>
<div>  (define out (get-output ev))</div><div>  (define err (get-error-output ev))</div><div>  (list res out err))</div></div><div><br></div><div>;;--------------------------------</div><div><br></div><div style>I know I can convert a pict structure like this: (convert a-pict &#39;png-bytes)</div>
<div style>but (evaluator &quot;(circle 10)&quot;) does not evaluate to a pict structure, so I can&#39;t use convert here.</div><div style><br></div><div style>I also cannot see how to use bitmap% save-file method here, because I cannot get my hands on the bitmap object<br>
</div></div><div><br></div><div style>Is there a way to parameterize how picts are rendered so I can end up with a PNG bytestring ?</div><div style><br></div><div style>Thank you</div><div style><br></div><div style>Manu</div>
<div style><br></div><div><br></div><div><br></div></div>