RosettaCodeData/Task/Exponentiation-operator/PicoLisp/exponentiation-operator.l
2014-01-17 05:34:36 +00:00

10 lines
242 B
Text

(de ** (X N) # N th power of X
(if (ge0 N)
(let Y 1
(loop
(when (bit? 1 N)
(setq Y (* Y X)) )
(T (=0 (setq N (>> 1 N)))
Y )
(setq X (* X X)) ) )
0 ) )