RosettaCodeData/Task/Exponentiation-operator/Retro/exponentiation-operator-3.retro

8 lines
128 B
Text
Raw Permalink Normal View History

2014-04-02 16:56:35 +00:00
: pow ( n m -- n^m )
1 2rot
[ dup 1 and 0 <>
[ [ tuck * swap ] dip ] ifTrue
[ dup * ] dip 1 >> dup 0 <>
] while
drop drop ;