Page 1 sur 1
Testing Python Syntax
Publié : mer. mars 06, 2019 2:54 am
par compsystems
Letters := [ "a", "b", "c", "d", "e", "f", "g" ]
Letters[2:3] := [ ] [enter] "error"
=> [ "a", "b", "d", "e", "f", "g" ]
Re: Testing Python Syntax
Publié : mer. mars 06, 2019 3:14 pm
par parisse
This is not supported, you can use remove.
Re: Testing Python Syntax
Publié : jeu. mars 07, 2019 12:50 am
par compsystems
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" ]
Re: Testing Python Syntax
Publié : jeu. mars 07, 2019 9:39 am
par parisse
Indeed, I meant suppress, not remove.
Re: Testing Python Syntax
Publié : jeu. mars 07, 2019 8:44 pm
par compsystems
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
Re: Testing Python Syntax
Publié : ven. mars 08, 2019 12:55 pm
par parisse
Ok, I will add support for that. You can already suppress an interval by giving a 3rg argument.
Re: Testing Python Syntax
Publié : mar. mars 26, 2019 10:11 pm
par compsystems
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