e549b4ced6
FossilOrigin-Name: dfed0de00b8d63672a882b79c4951cce0076007ef208c063b2f4e54fe9bd08f8
13 lines
168 B
Forth
13 lines
168 B
Forth
# example|RecursiveFactorial
|
|
|
|
~~~
|
|
:<factorial>
|
|
dup #1 -eq? 0; drop
|
|
dup n:dec <factorial> * ;
|
|
|
|
:factorial
|
|
dup n:zero?
|
|
[ n:inc ]
|
|
[ <factorial> ] choose ;
|
|
~~~
|
|
|