reverse
fn reverse<T>(Vec<T> arr) -> Vec<T> Import
Source: use collections::{reverse}; src/collections.hy Returns a copy of arr in reverse order.
Parameters#
| Name | Type |
|---|---|
arr | Vec<T> |
Returns#
Vec<T>
Contracts#
Checked according to --contracts (see Contracts).
ensures result.len() == arr.len()
Examples#
use collections::{reverse};
use tests::assert;
let xs: Vec<int> = [1, 2, 3];
assert!(reverse(xs)[0] == 3);
See also#
sort: Returns a sorted copy ofarr, in ascending order.sort_by: Returns a copy ofarrsorted by the valuekeygives each element, in ascending order.collect_ints: Returns the values of the rangea..bas aVec<int>.collect_ints_inclusive: Returns the values of the inclusive rangea..=bas aVec<int>.