New Issue: [feature request] Reverse method on list

19997, "bmcdonald3", "[feature request] Reverse method on list", "2022-06-14T20:30:50Z"

Adding a reverse method to list would make certain idioms easier to write and allow more of a queue-like usage. This is something that is supported in Python.

For example, given the list l with values [1, 2, 3], you have to pop from the front each time to get this behavior, which is not a cheap operation:

var first = l.pop(0); // stores, 1; pops from front of list
var second = l.pop(0); // stores 2
var third = l.pop(0); // stores 3

So, it is rather ugly, but, more importantly, the indexed pop is expensive.

Instead, something like:

l.reverse(); // new list: [3, 2, 1]
var first = l.pop(); // stores 1
var second = l.pop(); // stores 2
var third = l.pop(); // stores 3

A queue data structure might also solve the issue mentioned here.