Erlang standard library quirks

Serge Aleynikov serge@REDACTED
Thu Feb 16 18:47:00 CET 2006


Apparently if lists:keysearch/3 is used the value returned (if found) 
should always be a tuple, so the use of {value, Value} is indeed excessive.

1> lists:keysearch(a, 1, [{b,2}, {a, false}]).
{value,{a,false}}
2> lists:keysearch(c, 1, [{b,2}, {a, false}]).
false

Samuel Montgomery-Blinn wrote:
> James Hague wrote:
> 
>> One more:
>>
>> lists:keysearch returns "{value, Tuple} | false" instead of just
>> "Tuple | false".
>>
>>  
>>
> This is to distinguish the value "false" from the return code of 
> "false", unless I am using the function incorrectly.
> 
> -Sam
> 

-- 
Serge Aleynikov
R&D Telecom, IDT Corp.
Tel: (973) 438-3436
Fax: (973) 438-1464
serge@REDACTED



More information about the erlang-questions mailing list