<br><div class="gmail_quote">On Wed, Jan 21, 2009 at 10:56 AM, Richard Carlsson <span dir="ltr"><<a href="mailto:richardc@it.uu.se">richardc@it.uu.se</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">Bjorn Gustavsson wrote:<br>
> On Tue, Jan 20, 2009 at 4:15 PM, James Hague <<a href="mailto:james.hague@gmail.com">james.hague@gmail.com</a>> wrote:<br>
>> I would like to propose the addition of lists:keyfind/3, which is<br>
>> identical in structure to lists:keysearch/3, except that it returns<br>
>> either 'false' or the found tuple, with no additional wrapping of the<br>
>> result.  This can be trivially added to the lists module:<br>
>><br>
>>   keyfind(K, N, L) -><br>
>>      case keysearch(K, N, L) of<br>
>>         {_, Tuple} -> Tuple;<br>
>>         X -> X<br>
>>      end.<br>
>><br>
><br>
> Good idea.<br>
><br>
> Unless someone has any good reasons agains this suggestion, we will probably<br>
> implement it in R13. (lists:keyfind/3 will be a BIF, and<br>
> lists:keysearch/3 implemented<br>
> in Erlang.)<br>
<br>
</div>Only that I always wince at the mixing of 'false' with {...}. Since this<br>
is a new function, I'd prefer 'error' (to pick another atom that is<br>
frequently used in Erlang libraries).</blockquote><div><br>I don't understand why 'error' is better than 'false'. 'false' is more broadly used than 'error' because it is all conditions result. Anyway when I ask someone to find something I found to get answer 'found' x 'not found' more expected than 'found' x 'error'. 'false' sounds for me as better answer to ask for `find` as 'true' I have found x 'false' I haven't found. Not found is not error, it is false result.<br>
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
<br>
    /Richard<br>
<br>
<br>
(Singing: "Eric the half-a-bool...")<br>
<div><div></div><div class="Wj3C7c">_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://www.erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://www.erlang.org/mailman/listinfo/erlang-questions</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>--Hynek (Pichi) Vychodil<br><br>Analyze your data in minutes. Share your insights instantly. Thrill your boss.  Be a data hero!<br>Try Good Data now for free: <a href="http://www.gooddata.com">www.gooddata.com</a><br>