I am writing a cache gen-server for the company Use. I am wondering how to search an item from the list as I want the cost of the search for comparing various data structure
Just to simplify on the example at https://stackoverflow.com/a/15587565/56250:
listFind(Element, List) ->
lists:member(Element, List).
lists:member works with empty lists. Quick look at the source (https://github.com/erlang/otp/blob/07b8f441ca711f9812fad9e9115bab3c3aa92f79/erts/emulator/beam/erl_bif_lists.c#L184) suggests it executes lazily.