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:

Introduced in 1988
 (1.0)
 |
Updated in 2003
 (5.0)
2007
 (6.0)