How to Search for an item in a List in Erlang?

后端 未结 7 1788
抹茶落季
抹茶落季 2021-01-04 07:56

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

相关标签:
7条回答
  • 2021-01-04 08:34

    You can also use any from http://erlang.org/doc/man/lists.html#any-2

    lists:any(fun(X) -> X == <<"yourthing">> end, YourList)
    

    will return true if found or false otherwise.

    0 讨论(0)
提交回复
热议问题