Logo

Programming-Idioms

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

Idiom #346 Repeated list

Create the list y from the list x repeated n times

import "slices"
y := slices.Repeat(x, n)
y = concat (take n (repeat x))
y = take (n * length x) (cycle x)
uses classes;
y := TList.Create;
for i := 1 to n do y.AddList(x);
y = x * n
y = x * n

New implementation...
< >
programming-idioms.org