Logo

Programming-Idioms

History of Idiom 12 > diff from v60 to v61

Edit summary for version 61 by Shoo:
New Erlang implementation by user [Shoo]

Version 60

2018-03-13, 22:11:29

Version 61

2018-12-27, 12:15:22

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|T]) -> 
  case H of
    Value -> true;
    _ -> member(T)
  end.