[erlang-questions] distinguish proplists vs. lists of proplists

Robert Virding <>
Tue Sep 15 22:46:56 CEST 2015


If you flip the order of the clauses it will work better. However there is
no safe way of distinguishing them, a prop*list* is just a list where the
elements should have a predefined structure.

Wouldn't it be better to have two functions, one which works on proplists
and one which works on lists of proplists? Or use maps instead of proplists?

Robert
On 15 Sep 2015 22:12, "Adam Krupicka" <> wrote:

> > In Adam’s example, the first function clause and guard sequence will
> match against a list of lists and any proplist.
>
> Oh yeah, missed that (:
>
> If you want to distinguish a list maybe containing two-element tuples
> from a proplist, you're gonna have a bad time. If it's just about
> telling a list of lists from a list of non-lists, that's easy enough ^^
>
> A.
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150915/562702f3/attachment.html>


More information about the erlang-questions mailing list