Testing Python Syntax

Messages in english

Modérateur : xcasadmin

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

Testing Python Syntax

Message par compsystems » mer. mars 06, 2019 2:54 am

Letters := [ "a", "b", "c", "d", "e", "f", "g" ]

Letters[2:3] := [ ] [enter] "error"
=> [ "a", "b", "d", "e", "f", "g" ]

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

Re: Testing Python Syntax

Message par parisse » mer. mars 06, 2019 3:14 pm

This is not supported, you can use remove.

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

Re: Testing Python Syntax

Message par compsystems » jeu. mars 07, 2019 12:50 am

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" ]

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

Re: Testing Python Syntax

Message par parisse » jeu. mars 07, 2019 9:39 am

Indeed, I meant suppress, not remove.

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

Re: Testing Python Syntax

Message par compsystems » jeu. mars 07, 2019 8:44 pm

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

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

Re: Testing Python Syntax

Message par parisse » ven. mars 08, 2019 12:55 pm

Ok, I will add support for that. You can already suppress an interval by giving a 3rg argument.

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

Re: Testing Python Syntax

Message par compsystems » mar. mars 26, 2019 10:11 pm

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

Répondre