Reverse

Reverse[expr]

reverses the order of the elements in expr.

Reverse[expr,n]

reverses elements at level n in expr.

Reverse[expr,{n1,n2,}]

reverses elements at levels n1, n2, in expr.

Details

  • Reverse works on SparseArray objects, reversing the elements in the corresponding ordinary array.
  • Reverse[expr] is equivalent to Reverse[expr,1].
  • For a matrix m, Reverse[m] reverses the order of the rows, and Reverse[m,2] reverses the order of the columns.

Examples

open allclose all

Basic Examples  (3)

Reverse an Association:

Reverse an Association on the first and second levels:

Generalizations & Extensions  (1)

Reverse works with heads other than List:

Applications  (3)

Reverse sublists:

Reverse operands:

Turn an array plot upside down:

Properties & Relations  (1)

Reverse is its own inverse:

Wolfram Research (1988), Reverse, Wolfram Language function, https://reference.wolfram.com/language/ref/Reverse.html (updated 2007).

Text

Wolfram Research (1988), Reverse, Wolfram Language function, https://reference.wolfram.com/language/ref/Reverse.html (updated 2007).

CMS

Wolfram Language. 1988. "Reverse." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2007. https://reference.wolfram.com/language/ref/Reverse.html.

APA

Wolfram Language. (1988). Reverse. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Reverse.html

BibTeX

@misc{reference.wolfram_2024_reverse, author="Wolfram Research", title="{Reverse}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/Reverse.html}", note=[Accessed: 21-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_reverse, organization={Wolfram Research}, title={Reverse}, year={2007}, url={https://reference.wolfram.com/language/ref/Reverse.html}, note=[Accessed: 21-November-2024 ]}