Logo

Programming-Idioms

History of Idiom 19 > diff from v4 to v5

Edit summary for version 5 by :

Version 4

2015-08-01, 16:40:25

Version 5

2015-08-19, 16:52:09

Idiom #19 Reverse a list

Reverse the order of the elements of list x .
This may reverse "in-place" and destroy the original ordering.

Idiom #19 Reverse a list

Reverse the order of the elements of list x .
This may reverse "in-place" and destroy the original ordering.

Code
let y: Vec<_> = x.iter().rev().collect();
Comments bubble
Instead of `Vec`, you can also use any other data structure that implements `collect`.
Demo URL
http://is.gd/kzJbJp