Samuel GOUGEON |
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. --> [%f int8(-3)] Undefined operation for the given operands. check or define function %b_c_i for overloading.It is surprising, because
An implementation is proposed for Scilab 6.1 (see the bugzilla report). Comments are welcome. Samuel _______________________________________________ users mailing list [hidden email] http://lists.scilab.org/mailman/listinfo/users |
Samuel GOUGEON |
Le 17/04/2018 à 18:49, Samuel Gougeon a
écrit :
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 _______________________________________________ users mailing list [hidden email] http://lists.scilab.org/mailman/listinfo/users |
Christophe Dang Ngoc Chan |
Hello Samuel,
> De la part de Samuel Gougeon > Envoyé : dimanche 22 avril 2018 16:06 > > http://bugzilla.scilab.org/15534 [...] > --> [%f int8(-3)] > [...] > > No comments? Unfortunately, I don't have any use of this kind of mix between booleans and integers so my opinion would not help very much. Are there some known applications where this is useful? I can imagine that integers between 0 and 1 can be used for fuzzy logic but I don't figure otherwise how the mix between different type of data, except for a list, can be interesting. Regards -- Christophe Dang Ngoc Chan [hidden email] 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 |
Clément David-3 |
In reply to this post by Samuel GOUGEON
Hello Samuel,
Le dimanche 22 avril 2018 à 16:06 +0200, Samuel Gougeon a écrit : > 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 To me the whole remark is in the (still open) type conversion topic : promotion or coercion to another type. Currently in Scilab most of the operations consume doubles and output doubles ; as most of our users are not computer scientists I prefer to have promotion to double whenever possible as it is currently rather than complex type coercion rules per operations (see the current implementation in modules/ast/src/cpp/operations). For exemple, using your proposal I am not sure about user expectation on: [%f int8(-3)] [int8(0) %t] [%f 1.] // promotion to double ! Thanks, -- Clément _______________________________________________ users mailing list [hidden email] http://lists.scilab.org/mailman/listinfo/users |
Free forum by Nabble | Edit this page |