Is there a cyclic list manipulate function? [closed]

I can't seem to find a function that will input x and output y. For my application, each of the numbers 1,2,3,4 represent a list, and the matrix is much larger.

x=[{1,2,3,4}]

y=[{{1,2,3,4},
{2,3,4,1},
{3,4,1,2},
{4,1,2,3}}]



Square brackets are only used for functions

x = Range[4]

(* {1, 2, 3, 4} *)

y = NestList[RotateLeft, x, Length[x] - 1]

(* {{1, 2, 3, 4}, {2, 3, 4, 1}, {3, 4, 1, 2}, {4, 1, 2, 3}} *)


If the extra brackets are intended

x = {Range[4]}

(* {{1, 2, 3, 4}} *)

y = {NestList[RotateLeft, x[[1]], Length[x[[1]]] - 1]}

(* {{{1, 2, 3, 4}, {2, 3, 4, 1}, {3, 4, 1, 2}, {4, 1, 2, 3}}} *)

Permute[Range[4], CyclicGroup[4]]

 {{1, 2, 3, 4}, {2, 3, 4, 1}, {3, 4, 1, 2}, {4, 1, 2, 3}}


You can also use RotateLeft:

RotateLeft[Range[4], #] & /@ Range[0, 3]

{{1, 2, 3, 4}, {2, 3, 4, 1}, {3, 4, 1, 2}, {4, 1, 2, 3}}

• CyclicGroup is what I needed. I'm planning on using a sequence of RGBColor in Colorize, so this works for me: tab = Permute[Tuples[{0, .5, 1}, 3], CyclicGroup[27]] Mar 14 '21 at 16:37
x = Range[4];
Partition[x, Length[x], 1, 1]


{{1, 2, 3, 4}, {2, 3, 4, 1}, {3, 4, 1, 2}, {4, 1, 2, 3}}