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