Reverse - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

# Online Help

###### All Products    Maple    MapleSim

ListTools

 Reverse
 reverse the order of a list

 Calling Sequence Reverse(L)

Parameters

 L - list

Description

 • The Reverse(L) function reverses the order of the elements in list L.
 Note: Within a procedure, it is likely that using negative indices is more efficient than creating a new list with elements that are reversed. Therefore, procedure Reverse should only be used for modifying lists that need to be returned in reverse order.

Examples

 > $\mathrm{with}\left(\mathrm{ListTools}\right):$
 > $L≔\left[1,2,3,4,5,6,7,8,9,10\right]$
 ${L}{≔}\left[{1}{,}{2}{,}{3}{,}{4}{,}{5}{,}{6}{,}{7}{,}{8}{,}{9}{,}{10}\right]$ (1)
 > ${L}_{7}$
 ${7}$ (2)
 > ${L}_{-7}$
 ${4}$ (3)
 > $R≔\mathrm{Reverse}\left(L\right)$
 ${R}{≔}\left[{10}{,}{9}{,}{8}{,}{7}{,}{6}{,}{5}{,}{4}{,}{3}{,}{2}{,}{1}\right]$ (4)
 > ${R}_{7}$
 ${4}$ (5)

 See Also