Kirk posted: <<<>> 2/ I would suggest that any numeric constant which include a 'j' or 'a' should return complex precision. (Except for 'b' constants such as 16ba, of course).
Eg: 1j0 1ar0 1ad0 <<<<>>>> NB. I agree with Kirk! NB. some interesting results: datatype each 3j6 3ar6 3ad6 1j0 │complex│complex│complex│complex│ datatype 1j0 integer datatype each 3j0 3ar0 3ad0 1j0 │integer│integer│integer│integer│ NB. Not good NB, However: datatype each 3j0 3j1 3ar0 3ar1 3ad0 3ad1 1j0 1j1 │complex│complex│complex│complex│complex│complex│complex│complex│ Skip Cave Cave Consulting LLC On Sat, Nov 23, 2019 at 11:29 AM Kirk Iverson <[email protected]> wrote: > 2/ I would suggest that any numeric constant which include a 'j' or 'a' > should return complex precision. > (Except for 'b' constants such as 16ba, of course). > > Eg: > 1j0 > 1ar0 > 1ad0 > > And that the representation of a verb such as (1j1-0j1)&+ be > 1j0&+ > > > 4/ I also noticed the following, but don't really have a position on > whether it's correct or not: > datatype 01 > integer > datatype 0".'01' > boolean > > > 5/ As an aside, could anyone have predicted the following? > 16ba0 > 160 > 2j160 > 2j160 > 2j16ba0 > 20j160 > > Of course anyone using 'j' and 'b' together deserves what they get. :) > > > /K > > > > On Fri, Nov 22, 2019 at 3:20 AM Henry Rich <[email protected]> wrote: > > > 1/ Because the decoration comes before the value, it was easier to put > > the 0 at the beginning of the display. That's a weak argument, but > > that's why I did it that way. > > > > 2/ I was just thinking about this last night. You're right, for > > consistency complex values should be decorated. But the point of the > > decoration is to have a linear form that faithfully reproduces the > > value. 1j0 does not produce a complex value. Before the decoration, we > > need to agree on a way to write a constant that produces a complex > > precision with imaginary part 0. > > > > 3/ I defer to Bill on this. > > > > Henry Rich > > > > On 11/22/2019 1:04 AM, Kirk Iverson wrote: > > > A recent thread in the programming forum (00 strange?) inspired me to > > look at this new behaviour in 901. > > > > > > NB. Numeric > > > datatype&.> 'b i f x c'=. 0 1;(0 1+0);(0 1%1);0 1x;0,1j1-0j1 > > > +-------+-------+--------+--------+-------+ > > > |boolean|integer|floating|extended|complex| > > > +-------+-------+--------+--------+-------+ > > > b&+ > > > 0 1&+ > > > i&+ > > > 00 1&+ <== (1) > > > f&+ > > > 0 1.&+ > > > x&+ > > > 0 1x&+ > > > c&+ > > > 0 1&+ <== (2) > > > > > > > > > NB. Character > > > d=. (0{a.);'abc' > > > 'lctrl lascii'=. d > > > 'uctrl uascii'=. u:&.> d > > > 'Uctrl Uascii'=. 10 u:&.> d > > > datatype&.>lctrl;lascii;uctrl;uascii;Uctrl;Uascii > > > +-------+-------+-------+-------+--------+--------+ > > > |literal|literal|unicode|unicode|unicode4|unicode4| > > > +-------+-------+-------+-------+--------+--------+ > > > lctrl&, > > > (00{a.)&, > > > lascii&, > > > 'abc'&, > > > uctrl&, > > > (u: 00)&, > > > uascii&, > > > (u: 97 98 99)&, <== (3) > > > Uctrl&, > > > (10&u: 00)&, > > > Uascii&, > > > (10&u: 97 98 99)&, <== (3) > > > > > > > > > 1/ Is there a reason that it is the first element of an integer array > > which has extra decoration, rather than the last element (as in the other > > cases)? > > > > > > 2/ Shouldn't this display as 0 1j0&+ ? > > > Also, when interpreting constants in a line of J: > > > 0 1 is boolean > > > 00 1 is integer > > > 0 1. is floating > > > 0 1x is extended (as is 0 1r1) > > > 0 1j0 is integer > > > Shouldn't this last one be complex? > > > > > > 3/ Can the representations of uascii and Uascii make use of literals > > (like lascii does)? > > > > > > /K > > > ---------------------------------------------------------------------- > > > For information about J forums see http://www.jsoftware.com/forums.htm > > > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
