lue-bird / elm-linear-direction / Set.Linear

Set operations that can be applied in either Direction

transform

foldFrom : accumulationValue -> Linear.Direction -> (element -> accumulationValue -> accumulationValue) -> Set element -> accumulationValue

Reduce in a Direction from a given initial accumulated thing

import Linear exposing (Direction(..))
import Set

Set.fromList [ 'i', 'l', 'a', 'g' ]
    |> Set.Linear.foldFrom "" Up String.cons
--> "liga"

Set.fromList [ 'i', 'l', 'a', 'g' ]
    |> Set.Linear.foldFrom "" Down String.cons
--> "agil"