# [racket] Math - factorial.rkt, binomial.rkt and memoization

At Tue, 9 Apr 2013 14:02:27 +0200, Laurent wrote:
>* But if you write all 10 cases, aren't the lists constructed anyway before
*>* calling `*'?
*
Applying `*' to N arguments doesn't construct a list of N arguments.
There's a continuation frame that accumulates the N arguments, but in a
way that tends to be much more efficient for the purposes of
constructing a function call.
For `(partial-factorial 0 1000000)', the difference doesn't matter,
since the 100000 or so bignum multiplications dominate. But I'd write
(for/fold ([v 1]) ([p (in-range (+ m 1) (+ n 1))])
(* v p))
or even
(for/product ([p (in-range (+ m 1) (+ n 1))]) p)