Mojo function
shallow_apply
shallow_apply[func: fn[?, origin: ImmutableOrigin](IntTuple[origin]) -> Int](t: IntTuple[origin]) -> IntTuple`
Apply a function to each top-level element of an IntTuple.
Unlike apply(), this function only operates on the immediate children
of the input tuple without recursing into nested tuples.
Parameters:
- func (
fn[?, origin: ImmutableOrigin](IntTuple[origin]) -> Int): Function that takes anIntTupleand returns anInt`.
Args:
- t (
IntTuple): TheIntTuplewhose elements will be transformed.
Returns:
IntTuple: A new IntTuple with the function applied to each top-level element.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!