Previous Up Next

6.3.15  Rotating a list

The rotate command rotates a list; namely it moves elements from one side and puts them on the other.

Examples

rotate([0,1,2,3,4])
     
⎡
⎣
4,0,1,2,3⎤
⎦
          
rotate([0,1,2,3,4],2)
     
⎡
⎣
2,3,4,0,1⎤
⎦
          
rotate([0,1,2,3,4],-2)
     
⎡
⎣
3,4,0,1,2⎤
⎦
          

Previous Up Next