Previous Up Next

6.42.14  Avoir la liste permutée à partir de son n-ième élément : shift

shift a comme argument une liste et un nombre entier relatif (par défaut n=-1).
shift renvoie :

On tape :

shift([0,1,2,3,4,5])

On obtient :

[0,0,1,2,3,4]

On tape :

shift([0,1,2,3,4,5],2)

On obtient :

[2,3,4,5,0,0]

On tape :

shift([0,1,2,3,4,5],-2)

On obtient :

[0,0,0,1,2,3]

On tape :

L:=[0,1,2,3,4,5]
L:=shift(L)

Ou on tape :

L:=[0,1,2,3,4,5]
L.shift()

On obtient la nouvelle valeur de L :

[0,0,1,2,3,4]

On tape :

L:=[0,1,2,3,4,5]
L:=shift(L,2)

Ou on tape :

L:=[0,1,2,3,4,5]
L.shift(2)

On obtient la nouvelle valeur de L :

L:=[2,3,4,5,0,0]

On tape :

L:=[0,1,2,3,4,5]
L:=shift(L,-2)

Ou on tape :

L:=[0,1,2,3,4,5]
L.shift(-2)

On obtient la nouvelle valeur de L :

[0,0,0,1,2,3]

Previous Up Next