The Dictionary says :
> The conjunction !: applies to integer scalar
> left and right arguments ...
I wrote:
> This phrase checks from 0!:0 to 255!:255
Noticing that the DoJ doesn't say the integers can't be negative, I took
this a bit further, and obstained some interesting results.
I looked at all pairs of integers from _1024 to 1024 (i.e. {;~i:2^10 ) .
I found 34 foriegns whose nameclass wasn't verb. In fact, it turned out
they were all adverbs:
0 600
1 480
2 360
3 240
4 120
5 0
5 993
5 994
6 _120
6 873
6 874
7 _240
7 753
7 754
8 _360
8 633
8 634
9 _480
9 513
9 514
10 393
10 394
12 153
12 154
13 33
13 34
14 _87
14 _86
15 _207
15 _206
16 _327
16 _326
17 _447
17 _446
I thought at first that the arguments to !: might have to be single bytes,
and the negative numbers might just represent "wraparound" (i.e. they're
identical into their complementary positive bytes) but that's clearly not
the case.
Some of these foreigns represent deprecated familes, and I suspect they're
throwbacks*. Others, however, seem to come come in pairs. This pattern is
also evident in the documented foreigns, where m!:(2*n) means query and
m!:(1+2*n) means set. However, I don't know if this paradigm is applicable
to adverbs (though we do have the example of 5!:0 and 5!:1 ).
Then you have thought provoking little gems like 0!:600 . Given the known
uses of 0!: apply to scripts, I tried passing one to 0!:600 :
'+' 0!:600
+
plus=.+
'plus' 0!:600
+
minus =. ]&.plus
'minus' 0!:600
]&.plus
(<'+') 0!:600
+
(5!:1{.;:'toJ') 0!:600
((10{a.) I.@(e.&(13{a.))@]} ])@:(#~ -.@((13 10{a.)&E.@,))
I'm not sure what to make of this, yet.
And I wonder what other foreigns are hiding under the covers. There's no
good way to distinguish between a m!:n that doesn't exist and one that's a
valid verb which you're supplying with inappropriate arguments (or even the
wrong number of arguments (viz valence) ).
-Dan
*: I can't think of a reason to "hide" an undocumented foreign in a
deprecated family, when it can be hidden just as effectively within its
"natural" (functionally related) family.
--
View this message in context:
http://www.nabble.com/Re%3A-Programming-Digest%2C-Vol-27%2C-Issue-39-tp14431754s24193p14445454.html
Sent from the J Programming mailing list archive at Nabble.com.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm