Page 1 sur 1

remove

Publié : sam. mai 18, 2019 5:20 pm
par compsystems
Hello BP, to give a similarity of REMOVE Xcas cmd with REMOVE Python cmd, allows a second argument that disables the elimination of mutiplicity or occurrence

lst1:=[1,1,1,2,3,4,5,5]
lst1.remove(1) [enter]
[2,3,4,5,5] # ok

lst1:=[1,1,1,2,3,4,5,5]
lst1.remove(1,off) [enter]
[1,1,2,3,4,5,5]

lst1.remove(1,off) [enter]
[1,2,3,4,5,5]

lst1.remove(1,off) [enter]
[2,3,4,5,5]

Re: remove

Publié : dim. mai 19, 2019 2:48 pm
par parisse
That would still not be compatible with Python remove. If you want to remove the first occurence, run find and suppress.

Re: remove

Publié : lun. mai 20, 2019 10:08 pm
par compsystems
Letters := [ "a", "b", "c", "d", "e", "f", "g" ]
suppress( Letters,:length(Letters)) [enter] returns
[ ] # ok

but

suppress( Letters,:) [enter] error
[ ] # ok

but