fast-elixir icon indicating copy to clipboard operation
fast-elixir copied to clipboard

Enum.member? vs el in list

Open augnustin opened this issue 5 years ago • 1 comments

Hey, great repo here! Thanks! I learnt a lot!

I landed here after searching for a comparison between:

is_list_member = Enum.member?(list, el)
# vs
is_in_list = el in list

Any chance you would add this idiom to the repo?

Cheers

augnustin avatar Nov 05 '20 09:11 augnustin

They should be exactly the same, left in right expands to an Enum.member? call, if right is not a list or range literal

michalmuskala avatar Nov 05 '20 10:11 michalmuskala