Variable-length quantity: Difference between revisions

m
Line 710:
to :: Int -> Int -> [Int]
to _ 0 = []
to base i = to base q <> [r]
where
let go = to base
in go (divq, i baser) ++= [modquotRem i base]
 
from :: Int -> [Int] -> Int
from base = foldl1 ((+) . (base *))
 
 
--------------------------- TEST ---------------------------
main :: IO ()
main =
9,655

edits