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}).
51 % TODO: Eliminate the 2nd lookup.
60 F3 = fun ({K, _}=X) -> {K, F2(X)} end,
67 fold(T, F1, Accumulator) ->
68 F2 = fun ({K, V}, Acc) -> F1(K, V, Acc) end,
69 lists:foldl(F2, T, Accumulator).
75 % TODO: Decide if validation is to be done here. Do so if yes.
79 %% ============================================================================
81 %% ============================================================================
84 fun ({K, V}) -> F(K, V) end.