Logo

Programming-Idioms

History of Idiom 12 > diff from v88 to v89

Edit summary for version 89 by heman:
New Haskell implementation by user [heman]

Version 88

2019-09-28, 13:38:23

Version 89

2019-09-30, 06:41:12

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
find _ [] = False
find x (x:xs) = True
find x (_:xs) = find x xs
Comments bubble
For empty list false.
If first element match true.
Check rest of the elements recursively.