HH\ImmSet::zip

Throws an exception unless the current ImmSet or the Traversable is empty.

Description

public function zip(
  Traversable<Tu> $traversable,
): ImmSet<Pair<Tv,Tu>>

Throws an exception unless the current ImmSet or the Traversable is empty.

Since ImmSets only support integers or strings as values, we cannot have a Pair as an ImmSet value. So in order to avoid an InvalidArgumentException, either the current ImmSet or the Traversable must be empty so that we actually return an empty ImmSet.

Parameters

  • Traversable<Tu> $traversable - The Traversable to use to combine with the elements of the current ImmSet.

Return Values

Examples

See Set::zip for usage examples.