This language bar is your friend. Select your favorite languages!

Idiom #227 Copy list

Create new list y containing the same elements as list x.

Subsequent modifications of y must not affect x (except for the contents referenced by the elements themselves if they contain pointers).

List<T> y = x.ToList();
List<Int32> y = new List<Int32>(x);
y := make([]T, len(x))
copy(y, x)
let y = x.slice();
y = x[:]
y = x.dup
let y = x.clone();

Do you know the best way to do this in your language ?
New implementation...

Idiom created by