retroforth/example/RecursiveFactorial.retro
crc 848ba7303b use .retro instead of .forth in examples
FossilOrigin-Name: b5feea667d30aac255d1cfca61fed355d438d2ce6021677f1e53af6302b15eee
2019-08-20 18:46:40 +00:00

13 lines
168 B
Text

# example|RecursiveFactorial
~~~
:<factorial>
dup #1 -eq? 0; drop
dup n:dec <factorial> * ;
:factorial
dup n:zero?
[ n:inc ]
[ <factorial> ] choose ;
~~~