Letters := [ "a", "b", "c", "d", "e", "f", "g" ]
Letters[2:3] := [ ] [enter] "error"
=> [ "a", "b", "d", "e", "f", "g" ]
Testing Python Syntax
Modérateur : xcasadmin
-
- Messages : 561
- Inscription : sam. févr. 04, 2017 11:34 pm
- Localisation : Colombia
- Contact :
Re: Testing Python Syntax
This is not supported, you can use remove.
-
- Messages : 561
- Inscription : sam. févr. 04, 2017 11:34 pm
- Localisation : Colombia
- Contact :
Re: Testing Python Syntax
remove, removes the first matching value, not a specific index
del removes the item at a specific index:
Letters := [ "a", "b", "c", "d", "e", "f", "g" ]
del Letters[1] > [ "a", "c", "d", "e", "f", "g" ] # but Xcas is not interpreting it,
Letters := [ "a", "b", "c", "d", "e", "f", "g" ]
del Letters[1:3] > [ "a", "d", "e", "f", "g" ]
I think that Xcas purge should accept a second argument, if the first argument is a list
purge( Letters, 1 ) > [ "a", "c", "d", "e", "f", "g" ]
purge( Letters, 1:3 ) > [ "a", "d", "e", "f", "g" ]
del removes the item at a specific index:
Letters := [ "a", "b", "c", "d", "e", "f", "g" ]
del Letters[1] > [ "a", "c", "d", "e", "f", "g" ] # but Xcas is not interpreting it,
Letters := [ "a", "b", "c", "d", "e", "f", "g" ]
del Letters[1:3] > [ "a", "d", "e", "f", "g" ]
I think that Xcas purge should accept a second argument, if the first argument is a list
purge( Letters, 1 ) > [ "a", "c", "d", "e", "f", "g" ]
purge( Letters, 1:3 ) > [ "a", "d", "e", "f", "g" ]
Re: Testing Python Syntax
Indeed, I meant suppress, not remove.
-
- Messages : 561
- Inscription : sam. févr. 04, 2017 11:34 pm
- Localisation : Colombia
- Contact :
Re: Testing Python Syntax
suppres currently supports a integer value, in a later version please add support in interval
Letters := [ "a", "b", "c", "d", "e", "f", "g" ]
suppres( Letters, 1 ) > [ "a", "c", "d", "e", "f", "g" ]
suppress( Letters, 1:3 ) > [ "a", "e", "f", "g" ]
Thanks
Letters := [ "a", "b", "c", "d", "e", "f", "g" ]
suppres( Letters, 1 ) > [ "a", "c", "d", "e", "f", "g" ]
suppress( Letters, 1:3 ) > [ "a", "e", "f", "g" ]
Thanks
Re: Testing Python Syntax
Ok, I will add support for that. You can already suppress an interval by giving a 3rg argument.
-
- Messages : 561
- Inscription : sam. févr. 04, 2017 11:34 pm
- Localisation : Colombia
- Contact :
Re: Testing Python Syntax
in the most recent version suppress( Letters, 1:3 ) > [ "a", "e", "f", "g" ] works well =)
to follow the python syntax, please add DEL(varname[pos]) as equivalent to suppres(varname,pos)
Thanks
to follow the python syntax, please add DEL(varname[pos]) as equivalent to suppres(varname,pos)
Thanks