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: 1.0.0b1
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).

reversed

reversed[T: ReversibleRange](value: T) -> _StridedRange

Get a reversed iterator of the input range.

Note: iterators are currently non-raising.

Parameters:

Args:

  • value (T): The range to get the reversed iterator of.

Returns:

_StridedRange: The reversed iterator of the range.

reversed[T: Copyable](ref value: List[T]) -> _ListIter[T, origin_of(value), False]

Get a reversed iterator of the input list.

Note: iterators are currently non-raising.

Parameters:

  • T (Copyable): The type of the elements in the list.

Args:

  • value (List[T]): The list to get the reversed iterator of.

Returns:

_ListIter[T, origin_of(value), False]: The reversed iterator of the list.

reversed[T: Copyable, size: Int](ref value: InlineArray[T, size]) -> _InlineArrayIter[T, size, origin_of(value), False]

Get a reversed iterator of the input array.

Note: iterators are currently non-raising.

Parameters:

  • T (Copyable): The type of the elements in the array.
  • size (Int): The size of the array.

Args:

Returns:

_InlineArrayIter[T, size, origin_of(value), False]: The reversed iterator of the array.

reversed[T: Copyable & ImplicitlyDestructible](ref value: Deque[T]) -> _DequeIter[T, origin_of(value), False]

Get a reversed iterator of the deque.

Note: iterators are currently non-raising.

Parameters:

Args:

  • value (Deque[T]): The deque to get the reversed iterator of.

Returns:

_DequeIter[T, origin_of(value), False]: The reversed iterator of the deque.

reversed[K: KeyElement, V: Copyable & ImplicitlyDestructible, H: Hasher](ref value: Dict[K, V, H]) -> _DictKeyIter[K, V, H, origin_of(value), False]

Get a reversed iterator of the input dict.

Note: iterators are currently non-raising.

Parameters:

Args:

  • value (Dict[K, V, H]): The dict to get the reversed iterator of.

Returns:

_DictKeyIter[K, V, H, origin_of(value), False]: The reversed iterator of the dict keys.

reversed[dict_mutability: Bool, //, K: KeyElement, V: Copyable & ImplicitlyDestructible, H: Hasher, dict_origin: Origin[mut=dict_mutability]](ref value: _DictValueIter[K, V, H, dict_origin]) -> _DictValueIter[K, V, H, dict_origin, False]

Get a reversed iterator of the input dict values.

Note: iterators are currently non-raising.

Parameters:

Args:

Returns:

_DictValueIter[K, V, H, dict_origin, False]: The reversed iterator of the dict values.

reversed[dict_mutability: Bool, //, K: KeyElement, V: Copyable & ImplicitlyDestructible, H: Hasher, dict_origin: Origin[mut=dict_mutability]](ref value: _DictEntryIter[K, V, H, dict_origin]) -> _DictEntryIter[K, V, H, dict_origin, False]

Get a reversed iterator of the input dict items.

Note: iterators are currently non-raising.

Parameters:

Args:

Returns:

_DictEntryIter[K, V, H, dict_origin, False]: The reversed iterator of the dict items.

reversed[T: Copyable](value: Span[T]) -> _SpanIter[T, value.origin, False]

Get a reversed iterator of the input Span.

Note: iterators are currently non-raising.

Parameters:

  • T (Copyable): The type of the elements in the Span.

Args:

  • value (Span[T]): The Span to get the reversed iterator of.

Returns:

_SpanIter[T, value.origin, False]: The reversed iterator of the Span.