Variable-length quantity: Difference between revisions
m
→{{header|Haskell}}
Line 710:
to :: Int -> Int -> [Int]
to _ 0 = []
to base i = to base q <> [r]
where
from :: Int -> [Int] -> Int
from base = foldl1 ((+) . (base *))
--------------------------- TEST ---------------------------
main :: IO ()
main =
|