elem

Does the element occur in the structure? Note: elem is often used in infix form.

Examples

Basic usage:
>>> 3 `elem` []
False
>>> 3 `elem` [1,2]
False
>>> 3 `elem` [1,2,3,4,5]
True
For infinite structures, the default implementation of elem terminates if the sought-after value exists at a finite distance from the left side of the structure:
>>> 3 `elem` [1..]
True
>>> 3 `elem` ([4..] ++ [3])
* Hangs forever *
elem is the list membership predicate, usually written in infix form, e.g., x `elem` xs. For the result to be False, the list must be finite; True, however, results from an element equal to x found at a finite index of a finite or infinite list.

Examples

>>> 3 `elem` []
False
>>> 3 `elem` [1,2]
False
>>> 3 `elem` [1,2,3,4,5]
True
>>> 3 `elem` [1..]
True
>>> 3 `elem` [4..]
* Hangs forever *
O(n) elem is the ByteString membership predicate.
O(n) elem is the ByteString membership predicate. This implementation uses memchr(3).
O(n) elem is the ShortByteString membership predicate.
O(n) The elem function takes a character and a Text, and returns True if the element is found in the given Text, or False otherwise.
O(n) elem is the stream membership predicate. Properties
elem c . stream = elem c
Are any values in the stream equal to the given value? Stops consuming as soon as a match is found. Subject to fusion
(elem a p) returns True if p has an element equal to a, False otherwise
(elem a) returns True if the container has an element equal to a, False otherwise
(elem w8) returns True if the byte stream has a byte equal to w8, False otherwise
(elem c) returns True if the text stream has a character equal to c, False otherwise
Like elem but doesn't work on Set and HashSet for performance reasons.
>>> elem 'x' ("abc" :: String)
False

>>> elem False (one True :: Set Bool)
...
... Do not use 'elem' and 'notElem' methods from 'Foldable' on Set
Suggestions:
Instead of
elem :: (Foldable t, Eq a) => a -> t a -> Bool
use
member :: Ord a => a -> Set a -> Bool
...
Instead of
notElem :: (Foldable t, Eq a) => a -> t a -> Bool
use
not . member
...
Exhaust a stream remembering only whether a was an element.
Does the element occur in the structure?
O(n) Check if the vector contains an element
O(n) Check if the vector contains an element
O(n) Check if the vector contains an element
O(n) Check if the vector contains an element
Synonym for oelem
Determine whether any element in the byte stream matches the given Word8
Is the byte a member of the byte sequence?
True if the item occurs in the list
Determine whether an element is present in the stream.
elem = Stream.fold Fold.elem