Non-decimal radices/Convert: Difference between revisions
m
→{{header|Haskell}}: Minor tidying
No edit summary |
m (→{{header|Haskell}}: Minor tidying) |
||
Line 1,378:
If we want to assume a default character set, then a general '''toBase''' (Int -> Int -> String) can be also be derived from '''inBaseDigits'''.
<lang haskell>import Data.
import Data.
inBaseDigits ::
inBaseDigits ds n = reverse $ unfoldr go n
where
go
| 0 <
let (d, r)
in Just (ds !! r,
▲ else Nothing))
inLowerHex :: Int -> String
Line 1,412 ⟶ 1,410:
toBase :: Int -> Int -> String
toBase intBase n
| otherwise
main :: IO ()
|