filter -package:base -package:unordered-containers -package:text
O(n) filter, applied to a predicate and a ByteString,
returns a ByteString containing those characters that satisfy the
predicate.
O(n) filter, applied to a predicate and a ByteString,
returns a ByteString containing those characters that satisfy the
predicate.
O(n) filter, applied to a predicate and a
ShortByteString, returns a ShortByteString containing those characters
that satisfy the predicate.
Filter all values that satisfy some predicate.
filter (> "a") (fromList [(5,"a"), (3,"b")]) == singleton 3 "b"
filter (> "x") (fromList [(5,"a"), (3,"b")]) == empty
filter (< "a") (fromList [(5,"a"), (3,"b")]) == empty
Filter all elements that satisfy some predicate.
Filter all values that satisfy the predicate.
filter (> "a") (fromList [(5,"a"), (3,"b")]) == singleton 3 "b"
filter (> "x") (fromList [(5,"a"), (3,"b")]) == empty
filter (< "a") (fromList [(5,"a"), (3,"b")]) == empty
The
filter function takes a predicate
p
and a sequence
xs and returns a sequence of those elements
which satisfy the predicate.
Filter all elements that satisfy the predicate.
O(n) Drop all elements that do not satisfy the predicate.
Drop elements which do not satisfy the predicate
Drop elements which do not satisfy the predicate
O(n) Drop all elements that do not satisfy the predicate.
O(n) Drop all elements that do not satisfy the predicate.
O(n) Drop all elements that do not satisfy the predicate.
O(n) Drop all elements that do not satisfy the predicate.
Filter all values that satisfy some predicate.
filter (> "a") (fromList [(5,"a"), (3,"b")]) == singleton 3 "b"
filter (> "x") (fromList [(5,"a"), (3,"b")]) == empty
filter (< "a") (fromList [(5,"a"), (3,"b")]) == empty
Filter all elements that satisfy some predicate.
Filter the entries whose keys are missing from the other map using
some
Applicative action.
filterAMissing f = Merge.Lazy.traverseMaybeMissing $
\k x -> (\b -> guard b *> Just x) <$> f k x
but this should be a little faster.
Filter all keys that satisfy some predicate.
filterKeys p = filterWithKey (\k _ -> p k)
filterKeys (> 4) (fromList [(5,"a"), (3,"b")]) == singleton 5 "a"
Filter the entries whose keys are missing from the other map.
filterMissing :: (k -> x -> Bool) -> SimpleWhenMissing x x
filterMissing f = Merge.Lazy.mapMaybeMissing $ \k x -> guard (f k x) *> Just x
but this should be a little faster.
Filter all keys/values that satisfy some predicate.
filterWithKey (\k _ -> k > 4) (fromList [(5,"a"), (3,"b")]) == singleton 5 "a"
Filter the entries whose keys are missing from the other map using
some
Applicative action.
filterAMissing f = Merge.Lazy.traverseMaybeMissing $
\k x -> (\b -> guard b *> Just x) <$> f k x
but this should be a little faster.