Logo

Programming-Idioms

History of Idiom 12 > diff from v62 to v63

Edit summary for version 63 by Foxy:
New Erlang implementation by user [Foxy]

Version 62

2018-12-27, 12:17:11

Version 63

2018-12-27, 12:22:51

Idiom #12 Check if list contains a value

Check if list contains a value x.
list is an iterable finite container.

Illustration

Idiom #12 Check if list contains a value

Check if list contains a value x.
list is an iterable finite container.

Illustration
Extra Keywords
array vector
Extra Keywords
array vector
Code
member(_, []) -> false;
member(Value, [H|_]) where Value =:= H -> true;
member(Value, [_|T]) -> member(Value, T).