cab-0.0.0: Utils.hs
module Utils where
import Data.List
fromDotted :: String -> [Int]
fromDotted [] = []
fromDotted xs = case break (=='.') xs of
(x,"") -> [read x :: Int]
(x,_:ys) -> (read x :: Int) : fromDotted ys
toDotted :: [Int] -> String
toDotted = joinBy "." . map show
joinBy :: String -> [String] -> String
joinBy sep = concat . intersperse sep
split :: Int -> [a] -> [[a]]
split _ [] = []
split n ss = x : split n rest
where
(x,rest) = splitAt n ss