RosettaCodeData/Task/Exponentiation-operator/Retro/exponentiation-operator-3.retro
2014-04-02 16:56:35 +00:00

7 lines
128 B
Text

: pow ( n m -- n^m )
1 2rot
[ dup 1 and 0 <>
[ [ tuck * swap ] dip ] ifTrue
[ dup * ] dip 1 >> dup 0 <>
] while
drop drop ;