toy-lib-0.1.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Math.DigitsVector

Description

Digits by Vector

Synopsis

Documentation

toDigitsU :: Int -> Int -> Vector Int #

>>> toDigitsU 3 ((3^0)*1 + (3^1)*2 + (3^2)*1)
[1,2,1]

toNDigitsU :: Int -> Int -> Int -> Vector Int #

>>> toNDigitsU 3 3 ((3^0)*1 + (3^1)*0 + (3^2)*0)
[1,0,0]

unDigitsU :: Int -> Vector Int -> Int #

>>> unDigitsU 3 (U.fromList [1,2,1]) == ((3^0)*1 + (3^1)*2 + (3^2)*1)
True
>>> unDigitsU 3 (toDigitsU 3 ((3^0)*1 + (3^1)*2 + (3^2)*1)) == ((3^0)*1 + (3^1)*2 + (3^2)*1)
True