Skip to main content

Mojo function

apply_zip

apply_zip[func: fn(IntTuple, IntTuple) -> 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 (fn(IntTuple, IntTuple) -> 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.

apply_zip[func: fn(IntTuple, IntTuple) capturing -> IntTuple](t1: IntTuple, t2: IntTuple) -> IntTuple

Apply a capturing function to pairs of elements from two IntTuples.

This overload allows the function to capture variables from its environment.

Parameters:

  • func (fn(IntTuple, IntTuple) capturing -> IntTuple): Capturing function that takes two IntTuples and returns an IntTuple.

Args:

Returns:

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

apply_zip[func: fn(IntTuple, IntTuple, IntTuple) -> 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 (fn(IntTuple, IntTuple, IntTuple) -> 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.

apply_zip[func: fn(IntTuple, IntTuple, IntTuple) capturing -> IntTuple](t1: IntTuple, t2: IntTuple, t3: IntTuple) -> IntTuple

Apply a capturing function to triplets of elements from three IntTuples.

This overload allows the function to capture variables from its environment.

Parameters:

  • func (fn(IntTuple, IntTuple, IntTuple) capturing -> IntTuple): Capturing function that takes three IntTuples and returns an IntTuple.

Args:

Returns:

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

Was this page helpful?