<font class="Apple-style-span" face="'courier new', monospace">Here's a rookie question that stems from HtDP 29.3.2.</font><div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">The idea is to test an expression a number of times while timing it and compare to another version of the same function. The expression finds a route in a vector (graph) from node 0 to node 4. The way I would do this in C/Python is with a while loop, while the counter is not zero execute the expression (ignore return value), and wrap it in the timer. In Racket I came up with:</font><div>
<font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div><div><font class="Apple-style-span" face="'courier new', monospace">(time (for-each</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> (lambda (dest) (find-route 0 dest Graph))</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> (make-list 1000 4)))</font></div></div><div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div>
<font class="Apple-style-span" face="'courier new', monospace">It seems unnecessarily tricky, but I couldn't think of a better way. Am I missing a piece? Does it only seem tricky because Racket is my first functional language.</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" face="'courier new', monospace">aTdHvAaNnKcSe</font></div><div><font class="Apple-style-span" face="'courier new', monospace"><br>
</font></div><div><font class="Apple-style-span" face="'courier new', monospace">^ actually unnecessarily tricky</font></div><div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">Luke</font></div><div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div><br></div></div>