:: Map k v -> (v -> Bool) -> Map k v -package:dhall
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
O(n). 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
Strip all leading and trailing occurrences of an element passing a
predicate and make all other consecutive occurrences uniq.
prune p = dropWhileAround p $ uniqBy (x y -> p x && p y)
> Stream.prune isSpace (Stream.fromList " hello world! ")
"hello world!"
Space:
O(1)
Unimplemented
Take all consecutive elements at the end of the stream for which the
predicate is true.
O(n) space, where n is the number elements taken.
Unimplemented
Like
takeWhile and
takeWhileLast combined.
O(n) space, where n is the number elements taken from the end.
Unimplemented
Drop all consecutive elements at the end of the stream for which the
predicate is true.
O(n) space, where n is the number elements dropped.
Unimplemented
Like
dropWhile and
dropWhileLast combined.
O(n) space, where n is the number elements dropped from the end.
Unimplemented
Filter based on edge label property.
Filter all values that satisfy some predicate.