[Scilab-users] == and : relative priorities, as in 0==-1:1

classic Classic list List threaded Threaded
7 messages Options
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

[Scilab-users] == and : relative priorities, as in 0==-1:1

Hello,

Here is a strange -- rather unexpected -- trivial behavior:

--> p = 0; p==-1:1
Undefined operation for the given operands.
check or define function %b_b_s for overloading.

I would have expected [%f %t %f], but "==" 's priority is higher than ":"'s one,
and the expression is parsed (p==-1):1.
It's the same with other comparisons, like p>-1:1.

It was the same behavior in Scilab 5.5.2.

Since by default ":" is defined and meaningful for a very limited
set of operands types: numbers and text (, and that ":" does not
accept a vector as  operands), what about inverting the comparisons
and ":" relative priorities, in order to parse p==(-1:1) ?

"~" and comparisons relative priorities are inverted in Scilab 6.
That's more handy. IMO here is another opportunity get a more
relevant and handy behavior, by inverting ":" and comparisons ones.

Don't you think so?
Regards

Samuel


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: == and : relative priorities, as in 0==-1:1

Le 31/07/2018 à 21:51, Samuel Gougeon a écrit :
Hello,

Here is a strange -- rather unexpected -- trivial behavior:

--> p = 0; p==-1:1
Undefined operation for the given operands.
check or define function %b_b_s for overloading.

I would have expected [%f %t %f], but "==" 's priority is higher than ":"'s one,
and the expression is parsed (p==-1):1.
It's the same with other comparisons, like p>-1:1.

It was the same behavior in Scilab 5.5.2.

Since by default ":" is defined and meaningful for a very limited
set of operands types: numbers and text (, and that ":" does not
accept a vector as  operands), what about inverting the comparisons
and ":" relative priorities, in order to parse p==(-1:1) ?

"~" and comparisons relative priorities are inverted in Scilab 6.
That's more handy. IMO here is another opportunity get a more
relevant and handy behavior, by inverting ":" and comparisons ones.


It is somewhat reported here (in 2011..), but i don't understand
the conclusion of the report...


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Rafael Guerra Rafael Guerra
Reply | Threaded
Open this post in threaded view
|

Re: == and : relative priorities, as in 0==-1:1

In reply to this post by Samuel GOUGEON

Hi Samuel,

 

Parsing p==-1:1 as  p==(-1:1) would make Scilab output:

ans  =

  F T F

 

consistent with Matlab:

ans =

   1x3 logical array

   0   1   0

 

And with Octave:

ans =

  0  1  0

 

Regards,

Rafael

 

From: users <[hidden email]> On Behalf Of Samuel Gougeon
Sent: Tuesday, July 31, 2018 9:52 PM
To: International users mailing list for Scilab. <[hidden email]>
Subject: [Scilab-users] == and : relative priorities, as in 0==-1:1

 

Hello,

Here is a strange -- rather unexpected -- trivial behavior:

--> p = 0; p==-1:1
Undefined operation for the given operands.
check or define function %b_b_s for overloading.

I would have expected
[%f %t %f], but "==" 's priority is higher than ":"'s one,
and the expression is parsed
(p==-1):1.
It's the same with other comparisons, like
p>-1:1.

It was the same behavior in Scilab 5.5.2.

Since by default ":" is defined and meaningful for a very limited
set of operands types: numbers and text (, and that ":" does not
accept a vector as  operands), what about inverting the comparisons
and ":" relative priorities, in order to parse
p==(-1:1) ?

"~" and comparisons relative priorities are inverted in Scilab 6.
That's more handy. IMO here is another opportunity get a more
relevant and handy behavior, by inverting ":" and comparisons ones.

Don't you think so?
Regards

Samuel


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Rafael Guerra Rafael Guerra
Reply | Threaded
Open this post in threaded view
|

Re: == and : relative priorities, as in 0==-1:1

In reply to this post by Samuel GOUGEON

Le 31/07/2018 à 21:51, Samuel Gougeon a écrit :

It is somewhat reported here (in 2011..), but i don't understand
the conclusion of the report...
  : “It seems that "he who must not be named" has different priorities on operators.”

 

                 Is Voldemort working in the Scilab team?


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Antoine ELIAS-2 Antoine ELIAS-2
Reply | Threaded
Open this post in threaded view
|

Re: == and : relative priorities, as in 0==-1:1

Haha, I was referring to Matlab.
It was a private joke with Bruno.
Sorry about for misunderstanding.

Antoine
Le 31/07/2018 à 22:20, Rafael Guerra a écrit :

Le 31/07/2018 à 21:51, Samuel Gougeon a écrit :

It is somewhat reported here (in 2011..), but i don't understand
the conclusion of the report...
  : “It seems that "he who must not be named" has different priorities on operators.”

 

                 Is Voldemort working in the Scilab team?



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Christophe Dang Ngoc Chan Christophe Dang Ngoc Chan
Reply | Threaded
Open this post in threaded view
|

Re: {EXT} == and : relative priorities, as in 0==-1:1

In reply to this post by Samuel GOUGEON
Hello,

> De : De la part de Samuel Gougeon
> Envoyé : mardi 31 juillet 2018 21:52
>
> --> p = 0; p==-1:1
> […]
> the expression is parsed (p==-1):1.
> […]
> what about inverting the comparisons
> and ":" relative priorities, in order to parse p==(-1:1) ?

I do agree with this.

Regards

--
Christophe Dang Ngoc Chan
Mechanical calculation engineer
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error), please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
mottelet mottelet
Reply | Threaded
Open this post in threaded view
|

Re: {EXT} == and : relative priorities, as in 0==-1:1



> Le 2 août 2018 à 09:08, Dang Ngoc Chan, Christophe <[hidden email]> a écrit :
>
> Hello,
>
>> De : De la part de Samuel Gougeon
>> Envoyé : mardi 31 juillet 2018 21:52
>>
>> --> p = 0; p==-1:1
>> […]
>> the expression is parsed (p==-1):1.
>> […]
>> what about inverting the comparisons
>> and ":" relative priorities, in order to parse p==(-1:1) ?
>
> I do agree with this.

+1

S.

>
> Regards
>
> --
> Christophe Dang Ngoc Chan
> Mechanical calculation engineer
> This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error), please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
> _______________________________________________
> users mailing list
> [hidden email]
> https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users