HH\Lib\Dict\partition_with_key
Returns a 2-tuple containing dicts for which the given keyed predicate
returned true
and false
, respectively
namespace HH\Lib\Dict;
function partition_with_key<Tk as arraykey, Tv>(
KeyedTraversable<Tk, Tv> $traversable,
(function(Tk, Tv): bool) $predicate,
): (dict<Tk, Tv>, dict<Tk, Tv>);
Time complexity: O(n * p), where p is the complexity of $predicate
.
Space complexity: O(n)
Parameters
KeyedTraversable<Tk,
Tv> $traversable
(function(Tk, Tv): bool) $predicate
Returns
(dict<Tk, Tv>, dict<Tk, Tv>)