<div dir="ltr">We do like the idea, however some time has to be spent on figuring out what the best API would be.<div><br></div><div><font face="monospace, monospace">ListOfMaps = [#{ key => 1}, #{ key => 2}],</font></div><div><font face="monospace, monospace">#{ key => 2 } == lists:keyfind(fun(#{ key := V }) -> V end, 2, ListOfMaps).</font></div><div><span style="font-family:monospace,monospace"><br></span></div><div><span style="font-family:monospace,monospace">#{ key => 2 } == lists:keyfind(key, 2, ListOfMaps).</span><font face="monospace, monospace"><br></font></div><div><span style="font-family:monospace,monospace"><br></span></div><div><span style="font-family:monospace,monospace">#{ key => 2 } == lists:find(fun(#{ key := V }) -> V end, 2, ListOfMaps).</span></div><div><span style="font-family:monospace,monospace"><br></span></div><div><font face="monospace, monospace">#{ key => 2 } == lists:mapfind(key, 2, ListOfMaps).</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">#{ key => 2 } == maps:findinlist(key, 2, ListOfMaps).</font><br><div class="gmail_extra"><br></div><div class="gmail_extra">Maybe there are other, better ideas?</div><div class="gmail_extra"><br></div><div class="gmail_extra">My preferences are either lists:keyfind with a fun, or lists:mapfind. I like lists:keyfind with a fun as it is more general, and allows me to use any container within a list, it is however not as clear is lists:mapfind in what the function does.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Also as I stated before, if we add calls for find, we should also add calls for the other variations of the function.</div><div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_quote">On Fri, Aug 18, 2017 at 11:23 AM, Max Lapshin <span dir="ltr"><<a href="mailto:max.lapshin@gmail.com" target="_blank">max.lapshin@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra">Ok.</div><div class="gmail_extra"><br></div><div class="gmail_extra">So I wanted to hear something like:</div><div class="gmail_extra"><br></div><div class="gmail_extra">a) it is already written, wait a bit</div><div class="gmail_extra">b) not written but a good idea: spend some time and write it</div><div class="gmail_extra">c) bad idea, will not accept it even if you write it.</div><div class="gmail_extra"><br></div></div>
<br>______________________________<wbr>_________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/list<wbr>info/erlang-questions</a><br>
<br></blockquote></div><br></div></div></div>