ListTools - Maple Programming Help

# Online Help

###### All Products    Maple    MapleSim

Home : Support : Online Help : Programming : Data Types : Tables, lists, and sets : ListTools Package : ListTools/Rotate

ListTools

 Rotate
 rotate the elements in a list

 Calling Sequence Rotate(L, N)

Parameters

 L - list N - integer

Description

 • The Rotate(L, N) function rotates the elements in list L by N positions.
 • In the special case where L contains no elements, $\left[\right]$ is returned.

Examples

 > $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)
 > $\mathrm{with}\left(\mathrm{ListTools}\right):$
 > $\mathrm{Rotate}\left(L,1\right)$
 $\left[{2}{,}{3}{,}{4}{,}{5}{,}{6}{,}{7}{,}{8}{,}{9}{,}{10}{,}{1}\right]$ (2)
 > $\mathrm{Rotate}\left(L,3\right)$
 $\left[{4}{,}{5}{,}{6}{,}{7}{,}{8}{,}{9}{,}{10}{,}{1}{,}{2}{,}{3}\right]$ (3)
 > $\mathrm{Rotate}\left(L,-3\right)$
 $\left[{8}{,}{9}{,}{10}{,}{1}{,}{2}{,}{3}{,}{4}{,}{5}{,}{6}{,}{7}\right]$ (4)
 > $\mathrm{Rotate}\left(L,-12\right)$
 $\left[{9}{,}{10}{,}{1}{,}{2}{,}{3}{,}{4}{,}{5}{,}{6}{,}{7}{,}{8}\right]$ (5)

 See Also

## Was this information helpful?

 Please add your Comment (Optional) E-mail Address (Optional) What is ? This question helps us to combat spam