IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).

Mojo function

apply_zip

def apply_zip[func: def(IntTuple, IntTuple) thin -> IntTuple](t1: IntTuple, t2: IntTuple) -> IntTuple

Apply a function to pairs of elements from two IntTuples.

This function zips two IntTuples together and applies the given function to each pair of elements, creating a new IntTuple with the results.

Parameters:

  • ​func (def(IntTuple, IntTuple) thin -> IntTuple): Function that takes two IntTuples and returns an IntTuple.

Args:

Returns:

IntTuple: A new IntTuple containing the results of applying func to each pair.

def apply_zip[FuncType: def(IntTuple, IntTuple) -> IntTuple](t1: IntTuple, t2: IntTuple, func: FuncType) -> IntTuple

Apply a function to pairs of elements from two IntTuples.

This overload takes the function as a runtime value so unified closures can capture from their environment.

Parameters:

  • ​FuncType (def(IntTuple, IntTuple) -> IntTuple): The zip function type.

Args:

  • ​t1 (IntTuple): First IntTuple.
  • ​t2 (IntTuple): Second IntTuple.
  • ​func (FuncType): Function that takes two IntTuples and returns an IntTuple.

Returns:

IntTuple: A new IntTuple containing the results of applying func to each pair.

def apply_zip[func: def(IntTuple, IntTuple, IntTuple) thin -> IntTuple](t1: IntTuple, t2: IntTuple, t3: IntTuple) -> IntTuple

Apply a function to triplets of elements from three IntTuples.

This function zips three IntTuples together and applies the given function to each triplet of elements, creating a new IntTuple with the results.

Parameters:

  • ​func (def(IntTuple, IntTuple, IntTuple) thin -> IntTuple): Function that takes three IntTuples and returns an IntTuple.

Args:

Returns:

IntTuple: A new IntTuple containing the results of applying func to each triplet.

def apply_zip[FuncType: def(IntTuple, IntTuple, IntTuple) -> IntTuple](t1: IntTuple, t2: IntTuple, t3: IntTuple, func: FuncType) -> IntTuple

Apply a function to triplets of elements from three IntTuples.

This overload takes the function as a runtime value so unified closures can capture from their environment.

Parameters:

  • ​FuncType (def(IntTuple, IntTuple, IntTuple) -> IntTuple): The zip function type.

Args:

  • ​t1 (IntTuple): First IntTuple.
  • ​t2 (IntTuple): Second IntTuple.
  • ​t3 (IntTuple): Third IntTuple.
  • ​func (FuncType): Function that takes three IntTuples and returns an IntTuple.

Returns:

IntTuple: A new IntTuple containing the results of applying func to each triplet.

Was this page helpful?