For comparisons we have equal (=) and not equal (~:) and less than (<) and 
larger than (>).
I ignore min (<.) and max (>.) and less or equal (<:) and larger or equal (>:) 
since I consider them as direct derivatives of < and >. Also match (-:) is 
ignored.

All four (=, ~:, < and >) have dyadic rank 0, but I am more interested in their 
differences, which, to me, are rather annoying.
We get
   =/2 4 ?.@$ 2
0 0 1 1
for obvious reasons, and likewise with the 3 other verbs.

But why is the next behavior different?
   =/;/2 4 ?.@$ 2
0
   ~:/;/2 4 ?.@$ 2
1
   </;/2 4 ?.@$ 2
|domain error
|       </;/2 4?.@$2
   >/;/2 4 ?.@$ 2
|domain error
|       >/;/2 4?.@$2

Because we can compare the boxed items, as is shown by
   /: ;/2 4 ?.@$ 2
0 1

Needless to say also the other comparisons go wrong
   <./;/2 4 ?.@$ 2
|domain error
|       <./;/2 4?.@$2
   <:/;/2 4 ?.@$ 2
|domain error
|       <:/;/2 4?.@$2

Of course I can circumvent the errors in one way or the other, e.g. by using 
/:, but usually that costs quite some performance. 
Is there any time soon that the techniques which are used to compare boxed 
atoms, like used in /: , will be used for < and > too?


R.E Boss

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to