<div dir="ltr">Thanks for the assurance. It helped me to focus on my world-&gt;list-of-vectors It turns out it did not return enough vectors (at least 2, I think) for initial-world.<div><br></div><div><br></div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Sun, Aug 11, 2013 at 12:34 PM, Matthias Felleisen <span dir="ltr">&lt;<a href="mailto:matthias@ccs.neu.edu" target="_blank">matthias@ccs.neu.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><div><div class="h5"><br><div><div>On Aug 10, 2013, at 7:04 PM, J G Cho wrote:</div><br><blockquote type="cite"><span style="border-collapse:separate;font-family:&#39;Lucida Grande&#39;;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium">I get an error (somewhat expectedly) when I try<div>
<br></div><div><div>  (big-bang init</div><div>            (on-tick random-walk 1)</div><div>            ;(on-key door-actions)</div><div>            (to-draw plot-render)</div><div>            ))</div></div><div><br></div>
<div>where plot-render is defined as</div><div><br></div><div><div>(define (plot-render world)</div><div>  (p:plot (p:lines</div><div>         (world-&gt;list-of-vectors world)</div><div>         #:color 6 #:label &quot;Random walk&quot;)))</div>
</div><div><br></div><div>with the following at the top</div><div><br></div><div>(require (prefix-in p: plot))<br></div><div><br></div><div>The error msg is</div><div><br></div><div>plot: could not determine sensible plot bounds; got x ∈ [0,0], y ∈ [1,1]<br>
</div><div><br></div><div>Is there way to let plot know of the context? Or pass a context to plot and extract the pixels and hand it over to via some proc in 2htdp/image? Or maybe there is a simple way?</div></span></blockquote>
</div><br><div><br></div></div></div><div>This works like a charm for me: </div><div><br></div><div><div>#lang racket </div><div><br></div><div>(require (prefix-in p: plot) 2htdp/universe)</div><div class="im"><div><br></div>
<div>(define (plot-render world)</div><div>  (p:plot (p:lines (world-&gt;list-of-vectors world)</div><div>           #:color 6 #:label &quot;Random walk&quot;)))</div><div><br></div></div><div>(define (world-&gt;list-of-vectors world)</div>
<div>  `(#(1 3) #(2 -2) #(4 3)))</div><div><br></div><div>(define (random-walk world)</div><div>  &#39;more-dummy)</div><div><br></div><div>(big-bang &#39;dummy ; init </div><div>          (on-tick random-walk 1)</div><div>
          (to-draw plot-render))</div></div><div><br></div><div>;; --- </div><div><br></div><div>When I had a student implement the first plot version, I intentionally made sure that plot returned something I could use in big-bang. </div>
<div><br></div><div>And btw, this works too: </div><div><br></div><div><div>#lang racket </div><div><br></div><div>(require (prefix-in p: plot) 2htdp/universe 2htdp/image)</div><div><br></div><div>(define (plot-render world)</div>
<div>  (overlay </div><div class="im"><div>   (p:plot (p:lines (world-&gt;list-of-vectors world)</div><div>                    #:color 6 #:label &quot;Random walk&quot;))</div></div><div>   (square 800 &#39;solid &#39;blue)))</div>
<div><br></div><div>(define (world-&gt;list-of-vectors world)</div><div>  `(#(1 3) #(2 -2) #(4 3)))</div><div><br></div><div>(define (random-walk world)</div><div>  &#39;more-dummy)</div><div><br></div><div>(big-bang &#39;dummy ; init </div>
<div>          (on-tick random-walk 1)</div><div>          (to-draw plot-render))</div></div><div><br></div></div></blockquote></div><br></div>