Feature suggestion -- return if true
Jussi Piitulainen
jpiitula at ling.helsinki.fi
Tue Apr 19 02:42:12 EDT 2011
Gregory Ewing writes:
> Chris Angelico wrote:
>
> > Question: How many factorial functions are implemented because a
> > program needs to know what n! is, and how many are implemented to
> > demonstrate recursion (or to demonstrate the difference between
> > iteration and recursion)? :)
(I can't get to the parent directly, so I follow up indirectly.)
Factorials become an interesting demonstration of recursion when done
well. There's a paper by Richard J. Fateman, citing Peter Luschny:
<http://www.cs.berkeley.edu/~fateman/papers/factorial.pdf>
<http://www.luschny.de/math/factorial/FastFactorialFunctions.htm>
Fateman's "major conclusion is that you should probably not use the
'naive' factorial programs for much of anything". I take this to
include their use as examples of recursion, unless the purpose is to
make the idea of recursion look bad.
More information about the Python-list
mailing list