[erlang-questions] distinguish proplists vs. lists of proplists
Richard A. O'Keefe
ok@REDACTED
Wed Sep 16 07:15:55 CEST 2015
On 16/09/2015, at 6:26 am, Drew Varner <drew.varner@REDACTED> wrote:
> A property in a proplist can be an atom or a tuple.
The problem is that the documentation for the proplists
module says that the elements of a proplist can be ANYTHING.
The documentation is a little confusing. proplists:get_value/[2,3]
only pays attention to pairs; other tuples might as well not be there.
Does anyone know *why* the proplists module is so tolerant of
junk in proplists? Is it because
get_value(Key, [{Key,Val}|_], _) -> Val;
get_value(Key, [Key|_], _) -> true;
get_value(Key, [_|Ps], Default) -> get_value(Key, Ps, Default);
get_value(Key, [], Default) -> Default.
is the easiest thing to write, or is there a use case for it?
More information about the erlang-questions
mailing list