How do you make this Haskell power function tail recursive?

Posted by Linda Cohen on Stack Overflow See other posts from Stack Overflow or by Linda Cohen
Published on 2010-04-30T01:18:45Z Indexed on 2010/04/30 1:27 UTC
Read the original article Hit count: 266

Filed under:
|
|
turboPower a 0 = 1
turboPower a b
    | even b = turboPower (a*a) (b `div` 2)
    | otherwise = a * turboPower a (b-1)

THANKS!

© Stack Overflow or respective owner

Related posts about haskell

Related posts about tail-recursion