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

reverse

def reverse(src: IntTuple) -> IntTuple

Reverses the order of elements in an IntTuple, recursively.

This function reverses the top-level elements of the IntTuple and recursively reverses any nested IntTuples.

Example:

from layout.int_tuple import IntTuple, reverse
var t = IntTuple(1, 2, IntTuple(3, 4))
var reversed = reverse(t) # returns ((4, 3), 2, 1)

Args:

  • src (IntTuple): The source IntTuple to reverse.

Returns:

IntTuple: A new IntTuple with elements in reversed order.

Was this page helpful?