<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">A property in a proplist can be an atom or a tuple.<div class=""><br class=""></div><div class=""><a href="https://gist.github.com/NineFX/c78ce7bae5b7fc6b0304" class="">https://gist.github.com/NineFX/c78ce7bae5b7fc6b0304</a></div><div class=""><br class=""></div><div class="">This gist works if you are sure that you will either get a list of lists or a proplist.</div><div class=""><br class=""></div><div class="">In Adam’s example, the first function clause and guard sequence will match against a list of lists and any proplist.</div><div class=""><br class=""></div><div class=""><div><blockquote type="cite" class=""><div class="">On Sep 15, 2015, at 7:58 PM, Adam Krupicka <<a href="mailto:akrupicka@mail.muni.cz" class="">akrupicka@mail.muni.cz</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><br class="">Not exactly sure what you're asking, but you can use pattern matching to<br class="">distinguish a list prom a proplist -  assuming your ordinary lists do<br class="">not contain two-element tuples:<br class=""><br class="">handle(List) when is_list(List) -><br class="">    ...;<br class="">handle([{_, _} | _] = Proplist) -><br class="">    ....<br class=""><br class=""><br class="">A.<br class=""><br class="">Excerpts from Mr rty ff's message of 2015-09-15 16:58:33 +0000:<br class=""><blockquote type="cite" class=""><br class="">Hi<br class=""><br class="">I write a function which gets proplists or list of proplists anf key. if the input is proplists I just use proplists:get_value to find a value corresponding to key. But if the input is lists of proplists I need to iterate over all its elements. and look for key in each of them. I amnot sure how to distinguish lists vs. proplists. lists:is_list returns true for both of them.<br class=""><br class="">Thanks<br class=""></blockquote>_______________________________________________<br class="">erlang-questions mailing list<br class=""><a href="mailto:erlang-questions@erlang.org" class="">erlang-questions@erlang.org</a><br class="">http://erlang.org/mailman/listinfo/erlang-questions<br class=""></div></blockquote></div><br class=""></div></body></html>