Wolfram ResearchPRODUCTSPURCHASEFOR USERSCOMPANYOUR SITES
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.

Documentation / Mathematica / Built-in Functions / Lists and Matrices / List Operations /

Further Examples: RotateRight

This rotates each element one place to the right.

In[1]:=

Out[1]=

This rotates each element two places to the right.

In[2]:=

Out[2]=

This rotates each element one place to the left.

In[3]:=

Out[3]=

Here is a array.

In[4]:=

Out[4]//MatrixForm=

This is the default case in which elements at level 1 are rotated 1 place to the right. In other words, the last row of submatrices goes to the top.

In[5]:=

Out[5]//MatrixForm=

When the second argument is {0, 1} or {0, 1, 0}, elements at level 2 are rotated 1 place to the right. In other words, the last column of submatrices goes to the far left.

In[6]:=

Out[6]//MatrixForm=

When the second argument is {0, 0, 1}, elements at level 3 are rotated 1 place to the right. In other words, the last element in each submatrix goes to the top of the submatrix.

In[7]:=

Out[7]//MatrixForm=

Here is a function that returns all permutations of the list {1, 1, 2, 2, ... , n, n}, such that there is 1 number between the two occurrences of 1, 2 numbers between the two occurrences of 2,... and n numbers between the two occurrences of n. (For another efficient implementation see the Further Examples for ReplaceList.)

In[8]:=

In[9]:=

Out[9]=

In[10]:=



Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information


 © 2009 Wolfram Research, Inc.  Terms of Use  Privacy Policy | [ja] |
Sign up for our newsletter: