lue-bird/elm-linear-direction/5.1.0

NOTE: the latest version is 11.2.0

Dict.Linear

transform

( accumulationValue
, { key : key
, value : value
}
-> accumulationValue
-> accumulationValue
)
-> Dict key value
-> accumulationValue

Reduce key-value-entries in a Dict in a direction.

import Linear exposing (DirectionLinear(..))
import Dict


Dict.fromList
    [ ( "Dies", 39 ), ( "Wonu", 22 ), ( "Eorfe", 18 ) ]
    |> Dict.Linear.foldFrom
        ( [], Up, \user -> (::) user.key )
--> [ "Wonu", "Eorfe", "Dies" ]


Dict.fromList
    [ ( "Dies", 39 ), ( "Wonu", 22 ), ( "Eorfe", 18 ) ]
    |> Dict.Linear.foldFrom
        ( [], Down, \user -> (::) user.key )
--> [ "Dies", "Eorfe", "Wonu" ]