Logo

Programming-Idioms

History of Idiom 12 > diff from v61 to v62

Edit summary for version 62 by Shoo:
[Erlang] orthography in atom name

Version 61

2018-12-27, 12:15:22

Version 62

2018-12-27, 12:17:11

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