[Scilab-users] [SEP] [boolean integer_class] concatenations

Samuel Gougeon sgougeon at free.fr
Sun Apr 22 16:06:13 CEST 2018


Le 17/04/2018 à 18:49, Samuel Gougeon a écrit :
>
> Hello,
>
> Surprisingly, as reported in http://bugzilla.scilab.org/15534, after 
> 30 years, Scilab still does not know how to concatenate booleans with 
> encoded integers.
> For instance :
>
> --> [%f int8(-3)]
>
> Undefined operation for the given operands.
> check or define function %b_c_i for overloading.
> It is surprising, because
>
>   * For some languages like Octave, booleans are actually some numbers
>     restricted to 0|1, and such simple concatenations are available.
>   * Implementing it in Scilab is trivial and does not really set any
>     question, since both 0 and 1 are present in all Scilab integer
>     classes.
>
> An implementation is proposed for Scilab 6.1 (see the bugzilla report).
>
> Comments are welcome.
>

No comments?

The only reason i have found to understand why this is still not 
implemented would be to let the user define its own overloads. But which 
alternative to casting %f=>0 %t=>1 could we have?
The first and may be only one we could imagine would be to cast integers 
into booleans, as in
[%t int8([0 -5])] => [%t %f %t]

Why not choosing this, instead of [%t int8([0 -5])] => int8([1 0 -5])?
It's a poorer result, that can be obtained in a straightforward way as
[%t int8([0 -5])]  =>  int8([1 0 -5])~=0

Regards
SG

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20180422/dc0bfbb6/attachment.htm>


More information about the users mailing list