filter -zlib +containers
O(n). Filter all elements that satisfy some predicate.
O(n). 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
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
O(n). The filter function takes a predicate p and a sequence xs and returns a sequence of those elements which satisfy the predicate.
O(n). Filter all elements that satisfy the predicate.
O(n). Filter all keys/values that satisfy some predicate.
> filterWithKey (\k _ -> k > 4) (fromList [(5,"a"), (3,"b")]) == singleton 5 "a"
O(n). Filter all keys/values that satisfy the predicate.
> filterWithKey (\k _ -> k > 4) (fromList [(5,"a"), (3,"b")]) == singleton 5 "a"