1 %%%----------------------------------------------------------------------------
2 %%% Equivalent to stdlib's orddict, but with a pretty (IMO), uniform interface.
3 %%%----------------------------------------------------------------------------
6 -behavior(hope_dictionary).
30 %% ============================================================================
32 %% ============================================================================
40 case lists:keyfind(K, 1, T)
46 lists:keystore(K, 1, T, {K, V}).
54 Map2 = lift_map_into_list(Map1),
55 lists:foreach(Map2, T).
58 Map2 = lift_map_into_list(Map1),
62 Map2 = lift_map_into_list(Map1),
63 lists:filter(Map2, T).
65 fold(T, F1, Accumulator) ->
66 F2 = fun ({K, V}, Acc) -> F1(K, V, Acc) end,
67 lists:foldl(F2, T, Accumulator).
76 %% ============================================================================
78 %% ============================================================================
80 lift_map_into_list(Map) ->
81 fun ({K, V}) -> {K, Map(K, V)} end.