DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Convert Radix In Haskell:
Contert integer to array of integer what each element is target radix.
convRadix :: (Integral b) => b -> b -> [b] convRadix n = unfoldr (\b -> if b == 0 then Nothing else Just (b `mod` n, b `div` n))
ex. > convRadix 10 1234 [4, 3, 2, 1] > convRadix 10 0  > convRadix 10 (-1) [9,9,...] (infinite)