Logo

Programming-Idioms

History of Idiom 19 > diff from v5 to v6

Edit summary for version 6 by :

Version 5

2015-08-19, 16:52:09

Version 6

2015-08-20, 16:24:21

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.

Imports
import std.range;
Code
auto y = x.retro;
Comments bubble
This doesn't allocate a new list, but creates an iterator that traverses the list in reverse order.
Demo URL
http://dpaste.dzfl.pl/ebf4256b37c4