HH\Lib\Vec\partition

Requires the Hack Standard Library to be installed.
Facebook Engineer?

This function is available as Vec\partition() in Facebook's www repository.

Returns a 2-tuple containing vecs for which the given predicate returned true and false, respectively

namespace HH\Lib\Vec;

function partition<Tv>(
  Traversable<Tv> $traversable,
  (function(Tv): bool) $predicate,
): (vec<Tv>, vec<Tv>);

Time complexity: O(n * p), where p is the complexity of $predicate Space complexity: O(n)

Parameters

Returns

  • (vec<Tv>, vec<Tv>)