remove

Messages in english

Modérateur : xcasadmin

compsystems
Messages : 561
Inscription : sam. févr. 04, 2017 11:34 pm
Localisation : Colombia
Contact :

remove

Message par compsystems » sam. mai 18, 2019 5:20 pm

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]

parisse
Messages : 5739
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: remove

Message par parisse » dim. mai 19, 2019 2:48 pm

That would still not be compatible with Python remove. If you want to remove the first occurence, run find and suppress.

compsystems
Messages : 561
Inscription : sam. févr. 04, 2017 11:34 pm
Localisation : Colombia
Contact :

Re: remove

Message par compsystems » lun. mai 20, 2019 10:08 pm

Letters := [ "a", "b", "c", "d", "e", "f", "g" ]
suppress( Letters,:length(Letters)) [enter] returns
[ ] # ok

but

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

but

Répondre