HH\Lib\Vec\zip
Requires the Hack Standard Library to be installed.
Facebook Engineer?
This function is available as Vec\zip()
in Facebook's www repository.
Returns a vec where each element is a tuple (pair) that combines, pairwise, the elements of the two given Traversables
namespace HH\Lib\Vec;
function zip<Tv, Tu>(
Traversable<Tv> $first,
Traversable<Tu> $second,
): vec<(Tv, Tu)>;
If the Traversables are not of equal length, the result will have the same number of elements as the shortest Traversable. Elements of the longer Traversable after the length of the shorter one will be ignored.
Time complexity: O(min(m, n)), where m is the size of $first
and n is the
size of $second
Space complexity: O(min(m, n)), where m is the size of $first
and n is the
size of $second
Parameters
Returns
vec<(Tv, Tu)>