next up previous contents index
suivant: Modify an element in monter: Lists and vectors précédent: Reverse a list starting   Table des matières   Index


Permuted list from its n-th element : shift

shift takes as argument a list l and an integer n (by default n=-1).
shift rotates the list to the left if n>0 or to the right if n<0. Elements leaving the list from one side are replaced by undef on the other side.
Input :
shift([0,1,2,3,4])
Output :
[undef,0,1,2,3]
Input :
shift([0,1,2,3,4],2)
Output :
[2,3,4,undef,undef]
Input :
shift([0,1,2,3,4],-2)
Output :
[undef,undef,0,1,2]



giac documentation written by Renée De Graeve and Bernard Parisse