At the Erlang shell:
> orddict:fetch(b, [{d, 2}, {a, 1}, {b,5}, {c,9}]).
** exception error: no function clause matching
orddict:fetch(b,[{d,2},{a,1},{b,5},{c,9}])
but
> orddict:fetch(b, [{a, 1}, {b,5}, {c,9}]).
5
What am I missing here?
References: orddict:fetch/2
The orddict docs describe an orddict as orddict() = [{Key :: term(), Value :: term()}].
The key to the solution to this problem is in the docs:
Use orddict:from_list/1 to convert from a regular list of
{key, value}pairs.