Previous Up Next

5.43.14  Modify an element in a list: subsop

subsop modifies an element in a list. subsop takes as argument a list and an equality (an index=a new value) in all syntax modes, but in Maple syntax mode the order of the arguments is reversed.
Remark If the second argument is ’k=NULL’, the element of index k is removed of the list.
Input in Xcas mode (the index of the first element is 0):

subsop([0,1,2],1=5)

or:

L:=[0,1,2];L[1]:=5

Output:

[0,5,2]

Input in Xcas mode (the index of the first element is 0):

subsop([0,1,2],’1=NULL’)

Output:

[0,2]

Input in Mupad TI mode (the index of the first element is 1):

subsop([0,1,2],2=5)

or:

L:=[0,1,2];L[2]:=5

Output:

[0,5,2]

In Maple mode the arguments are permuted and the index of the first element is 1.
Input:

subsop(2=5,[0,1,2])

or:

L:=[0,1,2];L[2]:=5

Output:

[0,5,2]

Previous Up Next