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

shallow_apply

def shallow_apply[func: def(IntTuple) thin -> Int](t: IntTuple) -> 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 (def(IntTuple) thin -> Int): Function that takes an IntTuple and returns an Int.

Args:

  • t (IntTuple): The IntTuple whose elements will be transformed.

Returns:

IntTuple: A new IntTuple with the function applied to each top-level element.

Was this page helpful?