[erlang-questions] performing lists:keysearch on a list of records
Mon Nov 23 09:00:38 CET 2015
Glad to meet everyone here.
I have a little question about the lists:keysearch function that I would like to search a record in a list by using one of its fields, because lists:keysearch is tuple-oriented and records is implemented internally as tuples, so I this the function should work as well to records, and it does as I tested in the shell. ( lists:keysearch(Key, 2, List), supposing the key is in the first field )
However I wonder if there's any side effects in this behavior, since I was taught that never access records' fields directly in the way of treating tuples.
P.S. There's another question here, is there any difference between lists:keyfind/3 and lists:keysearch/3? I can tell any difference between them except for the return value's formats.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions