RotateLeft [expr,n]
cycles the elements in expr n positions to the left.
RotateLeft [expr]
cycles one position to the left.
RotateLeft [expr,{n1,n2,…}]
cycles elements at successive levels ni positions to the left.
RotateLeft
RotateLeft [expr,n]
cycles the elements in expr n positions to the left.
RotateLeft [expr]
cycles one position to the left.
RotateLeft [expr,{n1,n2,…}]
cycles elements at successive levels ni positions to the left.
Details
- RotateLeft [expr,-n] rotates n positions to the right.
- RotateLeft can be used on SparseArray and Association objects.
Examples
open all close allBasic Examples (4)
Rotate two positions to the left:
RotateLeft[{a, b, c, d, e}, 2]Rotate one position to the left:
RotateLeft[{a, b, c, d, e}]Rotate Association one position to the left:
RotateLeft[<|1 -> a, 2 -> b, 3 -> c|>]Rotate Association on the first and second levels:
RotateRight[<|1 -> {a, b}, 2 -> {b, c}, 3 -> {c, d}|>, {1, 1}]Generalizations & Extensions (2)
Rotate one position left at the first level, and right at the second level:
RotateLeft[{{a, b, c}, {d, e, f}, {g, h, i}}, {1, -1}]Rotate an expression with any head:
RotateLeft[f[x, y, z]]Applications (4)
Successively rotate a list left:
NestList[RotateLeft, {a, b, c, d, e}, 4]Rotate successive rows of a matrix by their row number:
MapIndexed[RotateLeft, Table[{a, b, c, d}, {5}]]//TableFormRotate a 2D image:
ArrayPlot[RotateLeft[Table[If[x ^ 2 + y ^ 2 < 1, 1, 0], {x, -1, 1, 1 / 100}, {y, -1, 1, 1 / 100}], {40, 20}]]Rotate operands:
RotateLeft[a.b.c.d.e]Tech Notes
Related Guides
Related Links
History
Introduced in 1988 (1.0) | Updated in 2003 (5.0)
Text
Wolfram Research (1988), RotateLeft, Wolfram Language function, https://reference.wolfram.com/language/ref/RotateLeft.html (updated 2003).
CMS
Wolfram Language. 1988. "RotateLeft." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2003. https://reference.wolfram.com/language/ref/RotateLeft.html.
APA
Wolfram Language. (1988). RotateLeft. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RotateLeft.html
BibTeX
@misc{reference.wolfram_2026_rotateleft, author="Wolfram Research", title="{RotateLeft}", year="2003", howpublished="\url{https://reference.wolfram.com/language/ref/RotateLeft.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_rotateleft, organization={Wolfram Research}, title={RotateLeft}, year={2003}, url={https://reference.wolfram.com/language/ref/RotateLeft.html}, note=[Accessed: 12-June-2026]}