Mojo function
apply_zip
apply_zip[func: fn[ImmutableOrigin, ImmutableOrigin](IntTuple[$0], IntTuple[$1]) -> IntTuple](t1: IntTuple[origin], t2: IntTuple[origin]) -> IntTuple
Apply a function to pairs of elements from two IntTuple
s.
This function zips two IntTuple
s together and applies the given function
to each pair of elements, creating a new IntTuple
with the results.
Parameters:
- func (
fn[ImmutableOrigin, ImmutableOrigin](IntTuple[$0], IntTuple[$1]) -> IntTuple
): Function that takes twoIntTuple
s and returns anIntTuple
.
Args:
- t1 (
IntTuple[origin]
): FirstIntTuple
. - t2 (
IntTuple[origin]
): SecondIntTuple
.
Returns:
A new IntTuple
containing the results of applying func to each pair.
apply_zip[: origin.set, //, func: fn[ImmutableOrigin, ImmutableOrigin](IntTuple[$0], IntTuple[$1]) capturing -> IntTuple](t1: IntTuple[origin], t2: IntTuple[origin]) -> IntTuple
Apply a capturing function to pairs of elements from two IntTuple
s.
This overload allows the function to capture variables from its environment.
Parameters:
- func (
fn[ImmutableOrigin, ImmutableOrigin](IntTuple[$0], IntTuple[$1]) capturing -> IntTuple
): Capturing function that takes twoIntTuple
s and returns anIntTuple
.
Args:
- t1 (
IntTuple[origin]
): FirstIntTuple
. - t2 (
IntTuple[origin]
): SecondIntTuple
.
Returns:
A new IntTuple
containing the results of applying func to each pair.
apply_zip[func: fn[ImmutableOrigin, ImmutableOrigin, ImmutableOrigin](IntTuple[$0], IntTuple[$1], IntTuple[$2]) -> IntTuple](t1: IntTuple[origin], t2: IntTuple[origin], t3: IntTuple[origin]) -> IntTuple
Apply a function to triplets of elements from three IntTuple
s.
This function zips three IntTuple
s together and applies the given function
to each triplet of elements, creating a new IntTuple
with the results.
Parameters:
- func (
fn[ImmutableOrigin, ImmutableOrigin, ImmutableOrigin](IntTuple[$0], IntTuple[$1], IntTuple[$2]) -> IntTuple
): Function that takes threeIntTuple
s and returns anIntTuple
.
Args:
- t1 (
IntTuple[origin]
): FirstIntTuple
. - t2 (
IntTuple[origin]
): SecondIntTuple
. - t3 (
IntTuple[origin]
): ThirdIntTuple
.
Returns:
A new IntTuple
containing the results of applying func to each triplet.
apply_zip[: origin.set, //, func: fn[ImmutableOrigin, ImmutableOrigin, ImmutableOrigin](IntTuple[$0], IntTuple[$1], IntTuple[$2]) capturing -> IntTuple](t1: IntTuple[origin], t2: IntTuple[origin], t3: IntTuple[origin]) -> IntTuple
Apply a capturing function to triplets of elements from three IntTuple
s.
This overload allows the function to capture variables from its environment.
Parameters:
- func (
fn[ImmutableOrigin, ImmutableOrigin, ImmutableOrigin](IntTuple[$0], IntTuple[$1], IntTuple[$2]) capturing -> IntTuple
): Capturing function that takes threeIntTuple
s and returns anIntTuple
.
Args:
- t1 (
IntTuple[origin]
): FirstIntTuple
. - t2 (
IntTuple[origin]
): SecondIntTuple
. - t3 (
IntTuple[origin]
): ThirdIntTuple
.
Returns:
A new IntTuple
containing the results of applying func to each triplet.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!