Mojo function
reverse
reverse(src: IntTuple[origin]) -> 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 sourceIntTupleto reverse.
Returns:
IntTuple: A new IntTuple with elements in reversed order.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!