Sky.Core.List
Sky.Core.List — list combinators.
Values
any : (a -> Bool) -> List a -> Bool
`any pred list` — True iff `pred` holds for at least one element.
append : List a -> List a -> List a
`append xs ys` — concatenate two lists.
concat : List (List a) -> List a
`concat lists` — flatten a list of lists.
concatMap : (a -> List b) -> List a -> List b
`concatMap fn list` — map each element to a list and flatten
drop : Int -> List a -> List a
`drop n list` — `list` without its first `n` elements. `drop 0` and
filter : (a -> Bool) -> List a -> List a
`filter pred list` — keep only elements satisfying `pred`.
foldl : (a -> b -> b) -> b -> List a -> b
`foldl fn acc list` — left fold: `fn aN (… (fn a1 (fn a0 acc)))`.
foldr : (a -> b -> b) -> b -> List a -> b
`foldr fn acc list` — right fold: `fn a0 (fn a1 (… (fn aN acc)))`.
indexedMap : (Int -> a -> b) -> List a -> List b
`indexedMap fn list` — apply `fn` to each zero-based `(index, element)`
isEmpty : List a -> Bool
`isEmpty list` — True iff the list has no elements.
length : List a -> Int
`length list` — number of elements (O(1) on the slice representation).
map : (a -> b) -> List a -> List b
`map fn list` — apply `fn` to each element.
range : Int -> Int -> List Int
`range lo hi` — `[lo, lo + 1, …, hi]` (inclusive). `lo > hi` gives `[]`.
reverse : List a -> List a
`reverse list` — the list in reverse order.
take : Int -> List a -> List a
`take n list` — first `n` elements (or fewer when `list` is shorter).
zip : List a -> List b -> List ( a, b )
`zip xs ys` — pair-wise zip, truncated to the shorter list's length.
allfindheadtailconsmember