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]
remove
Modérateur : xcasadmin
-
- Messages : 561
- Inscription : sam. févr. 04, 2017 11:34 pm
- Localisation : Colombia
- Contact :
Re: remove
That would still not be compatible with Python remove. If you want to remove the first occurence, run find and suppress.
-
- Messages : 561
- Inscription : sam. févr. 04, 2017 11:34 pm
- Localisation : Colombia
- Contact :
Re: remove
Letters := [ "a", "b", "c", "d", "e", "f", "g" ]
suppress( Letters,:length(Letters)) [enter] returns
[ ] # ok
but
suppress( Letters,:) [enter] error
[ ] # ok
but
suppress( Letters,:length(Letters)) [enter] returns
[ ] # ok
but
suppress( Letters,:) [enter] error
[ ] # ok
but