Skip to main content
Log in

Mojo function

zip

zip[origin: ImmutableOrigin, n: Int](ts: InlineArray[Pointer[IntTuple, origin], n]) -> _zip[origin, n]

Create a zip iterator from an array of IntTuple pointers.

This function creates a zip iterator that allows simultaneous traversal of multiple IntTuple collections.

Parameters:

  • origin (ImmutableOrigin): The origin tracking parameter for memory safety.
  • n (Int): The number of IntTuple collections being zipped together.

Args:

  • ts (InlineArray[Pointer[IntTuple, origin], n]): Array of pointers to the IntTuple collections to zip.

Returns:

A _zip object that can be iterated over.

zip(a: IntTuple[origin], b: IntTuple[origin], out result: _zip[{a, b}, 2])

Create a zip iterator for two IntTuples.

This function creates a zip iterator that allows simultaneous traversal of two IntTuples, yielding pairs of corresponding elements.

Args:

  • a (IntTuple[origin]): First IntTuple to zip.
  • b (IntTuple[origin]): Second IntTuple to zip.

Returns:

The resulting zip iterator for the input IntTuples.

zip(a: IntTuple[origin], b: IntTuple[origin], c: IntTuple[origin], out result: _zip[{a, b, c}, 3])

Create a zip iterator for three IntTuples.

This function creates a zip iterator that allows simultaneous traversal of three IntTuples, yielding triplets of corresponding elements.

Args:

  • a (IntTuple[origin]): First IntTuple to zip.
  • b (IntTuple[origin]): Second IntTuple to zip.
  • c (IntTuple[origin]): Third IntTuple to zip.

Returns:

The resulting zip iterator for the input IntTuples.