Finding records in List

Arnaud GARCIA arnaud74130@REDACTED
Thu Jan 13 11:06:17 CET 2011


Hello,
(still learning erlang ;-)

I would like to find all records matching criterion/criteria in a list of
records.
if you have one criteria, you can use:

 lists:keyfind(Name,#person.name,ListOfPersonRecords).

=> But, it will return just the first one who match the criteria
=>Moreover with lists:keyfind I didn't find a way for multiple criteria like
: find all person in list where Name= and Age=

I saw an interesting post using record<->proplists... is it the way to do it
?
http://stackoverflow.com/questions/447188/erlang-and-run-time-record-limitations

Finally, I build my own function which parse the List and check if it match
the criterion or criteria BUT I was asking if there is an erlang function to
do this ?

thanks,

Arnaud


More information about the erlang-questions mailing list