Skip to main content
Log in

Mojo function

reversed

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

Get a reversed iterator of the input range.

Note: iterators are currently non-raising.

Parameters:

  • T (ReversibleRange): The type conforming to ReversibleRange.

Args:

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

Returns:

The reversed iterator of the range.

reversed[T: Copyable & Movable](ref value: List[T, hint_trivial_type]) -> _ListIter[T, hint_trivial_type, value_is_origin, False]

Get a reversed iterator of the input list.

Note: iterators are currently non-raising.

Parameters:

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

Args:

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

Returns:

The reversed iterator of the list.

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

Get a reversed iterator of the deque.

Note: iterators are currently non-raising.

Parameters:

  • T (Copyable & Movable): The type of the elements in the deque.

Args:

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

Returns:

The reversed iterator of the deque.

reversed[K: KeyElement, V: Copyable & Movable](ref value: Dict[K, V]) -> _DictKeyIter[K, V, value_is_origin, False]

Get a reversed iterator of the input dict.

Note: iterators are currently non-raising.

Parameters:

  • K (KeyElement): The type of the keys in the dict.
  • V (Copyable & Movable): The type of the values in the dict.

Args:

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

Returns:

The reversed iterator of the dict keys.

reversed[K: KeyElement, V: Copyable & Movable, dict_mutability: Bool, dict_origin: Origin[dict_mutability]](ref value: _DictValueIter[K, V, dict_origin]) -> _DictValueIter[K, V, dict_origin, False]

Get a reversed iterator of the input dict values.

Note: iterators are currently non-raising.

Parameters:

  • K (KeyElement): The type of the keys in the dict.
  • V (Copyable & Movable): The type of the values in the dict.
  • dict_mutability (Bool): Whether the reference to the dict values is mutable.
  • dict_origin (Origin[dict_mutability]): The origin of the dict values.

Args:

  • value (_DictValueIter[K, V, dict_origin]): The dict values to get the reversed iterator of.

Returns:

The reversed iterator of the dict values.

reversed[K: KeyElement, V: Copyable & Movable, dict_mutability: Bool, dict_origin: Origin[dict_mutability]](ref value: _DictEntryIter[K, V, dict_origin]) -> _DictEntryIter[K, V, dict_origin, False]

Get a reversed iterator of the input dict items.

Note: iterators are currently non-raising.

Parameters:

  • K (KeyElement): The type of the keys in the dict.
  • V (Copyable & Movable): The type of the values in the dict.
  • dict_mutability (Bool): Whether the reference to the dict items is mutable.
  • dict_origin (Origin[dict_mutability]): The origin of the dict items.

Args:

  • value (_DictEntryIter[K, V, dict_origin]): The dict items to get the reversed iterator of.

Returns:

The reversed iterator of the dict items.

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

Get a reversed iterator of the input Span.

Note: iterators are currently non-raising.

Parameters:

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

Args:

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

Returns:

The reversed iterator of the Span.