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

shallow_apply

shallow_apply[func: def(IntTuple) -> 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) -> 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.