<p>Thanks for the summary. I was going to post something similar shortly. As always, thanks to the community for your help.</p>
<p>Pat</p>
<p><blockquote type="cite">On May 10, 2011 7:51 PM, "Matthew Flatt" <<a href="mailto:mflatt@cs.utah.edu">mflatt@cs.utah.edu</a>> wrote:<br><br>I think all of your questions have been covered in the thread, but I'll<br>
answer them again to offer a few extra opinions and to summarize the<br>
discussion...<br>
<p><font color="#500050"><br>At Mon, 9 May 2011 18:38:41 -0500, Patrick King wrote:<br>> I now show the "approved" solution, and my...</font></p>For generic arithmetic on values other than fixnums, the local binding<br>
is likely worthwhile, mostly because it avoids repeated boxing of the<br>
arithmetic result. (At least for now; see below on plans for CSE.)<br>
<br>
I also find the code easier to read with the local binding.<br>
<p><font color="#500050"><br>> Question 1a: How creeped are you by my changing the meaning of error for<br>> these few lines? I ...</font></p>It didn't bother me or even occur to me that you were shadowing the<br>
usual `error' binding. Still, it's probably better to avoid shadowing<br>
bindings like `error' when you notice.<br>
<p><font color="#500050"><br>> Question 2: The approved solution favored (/ ... (+ x x)) over my (/ ... 2<br>> x). Cost of division...</font></p>The "strength" of arithmetic operations --- such as devision versus<br>
addition --- is unlikely to matter. The big effects are (1) using<br>
inexacts versus exact rationals, where inexacts tend to be faster, (2)<br>
mixing inexacts and exacts, which is slower than just inexacts, and (3)<br>
using flonum-specific operations (or Typed Racket with the `Float'<br>
type) versus generic operations, where flonum-specific operations can<br>
be much faster because they enable unboxing in the compiler.<br>
<p><font color="#500050"><br>> With multiple recalls of the same value?<br></font></p>The Racket compiler does not currently perform common-subexpression<br>
elimination (CSE). As it happens, I've been thinking about adding a CSE<br>
pass, but it's difficult to predict whether that will happen next week<br>
or next year.<br>
<br>
</blockquote></p>