simple standard library additions

Ulf Wiger (AL/EAB) <>
Fri Jun 16 09:15:55 CEST 2006


 
James Hague wrote:
> 
> % Should be in lists.
> keyfind(Key, N, TupleList) ->
>    case lists:keysearch(Key, N, TupleList) of
>       {value,X} -> X;
>       false -> false
>    end.

This particular type of operation is amply provided by proplists in
stdlib.

proplists:get_value(Key, KeyValueList) -> Value | undefined
proplists:get_value(Key, KVList, Default) -> Value | Default

BR,
Ulf W



More information about the erlang-questions mailing list