RosettaCodeData/Task/Exponentiation-operator/Forth/exponentiation-operator-2.fth

9 lines
139 B
Forth

: f**n ( f n -- f^n )
dup 0= if
drop fdrop 1e
else dup 1 and if
1- fdup recurse f*
else
2/ fdup f* recurse
then then ;