# [plt-scheme] recursion and efficiency?!

Lo, on Wednesday, April 21, Manfred Lotz did write:
>* On Wed, 21 Apr 2004 11:29:23 -0400
*>* Matthias Felleisen <matthias at ccs.neu.edu> wrote:
*
<SNIP>
>* > (2) Converting from plain recursion to tail-call optimizations often
*>* > reverses the order of operations for beginners. In your case,
*>* > big num arithmetic immediately dominates the calculations.
*>*
*>* I naively thought that because there is big num arithmetic in all
*>* three versions it would be pretty much the same from that point of
*>* view.
*
Right, but you'll have varying number of bignum operations, depending on
the order in which you do the multiplications. Of course, in this case,
I'm not sure how much this matters. I know 12! fits into a 32-bit
integer and 13! doesn't, so you won't do that many multiplications
before you overflow into bignum arithmetic even if you start with the
smaller numbers and work up. (You might not even be able to fit 12!
into a PLT fixnum; I don't remember how large those are, and I'm too
lazy to go look it up.)
Richard