[REBOL] Re: On ordinal and cardinal numbers...
From: dness:home at: 10-Jul-2001 0:41
Paul Tretter wrote:
> Since I'm relatively new at programming, can you explain what is meant by
> recursion and iteration? I just want to learn ;)
>
> Paul Tretter
>
Well the `real' answer to a question like this has been the subject of hundreds
if not thousands of PhD theses, so
(a) I'll give you the _very short_ answer; and
(b) Trust you'll go buy Knuth, Ableson, or any one of a number of basic
texts on programming which will at least tell you more.
Generally the prototypical answer is to describe the `factorial'.
Iteratively, n! = n * (n-1) * (n-2) * ... * 2 * 1
Recursively n! = n * (n-1)! , along with 0! = 1
Either of these defines the factorial, but in the recursive definition, the
notion of factorial is, itself, used in the definition.