Sha256: e3bbd68a2ccc4853bfc7fd580123c1457891eb442db6ec1a175ba1aee64c6b1d
Contents?: true
Size: 750 Bytes
Versions: 322
Compression:
Stored size: 750 Bytes
Contents
module Series exposing (..) import String import List import Result slices : Int -> String -> Result String (List (List Int)) slices size input = if size < 1 then Err ("Invalid size: " ++ toString size) else String.split "" input |> List.map String.toInt |> combine |> Result.map (takeRuns size) takeRuns : Int -> List Int -> List (List Int) takeRuns size numbers = let candidate = List.take size numbers in if List.length candidate < size || size < 1 then [] else candidate :: takeRuns size (List.drop 1 numbers) combine : List (Result x a) -> Result x (List a) combine = List.foldr (Result.map2 (::)) (Ok [])
Version data entries
322 entries across 322 versions & 1 rubygems