Oleg asked:
>  Why so complicated?

Because it does more, and is more general.  To add value to the thread, as 
simple solutions had been previously supplied.

Concretely, if you intend this:

OK>   [EMAIL PROTECTED] #: i.&,

to replace this:

DB>   E.&>/@:((>. - ,)&:(#@:$) ,:@:]^:[&.> ,&:<)

You will be unhappily suprised:

           0 1 2 dbp  i. 2 2 3
        0 0 0
        
           0 1 2 okp~ i. 2 2 3
        0 0 0
        0 0 1
        0 0 2
           
             4 5 dbp  i. 2 2 3
        0 1 1
           
             4 5 okp~ i. 2 2 3
        0 1 1
        0 1 2
           
Otherwise if you intended to replace   idx0 =. $ #: I.@:,  then note that (A) 
you cannot claim the advantage of "decreased complexity", (B)  idx0@:=  will 
return ALL the indices where  x = y  whereas  okp  will only return the FIRST 
index, and (C) the verb  idx0@:f  will return the indices where the predicate  
f  holds, for any predicate at all.  Therefore  okp  is less general.

-Dan

PS:  Plus  ,:^:(difference in rank)  is cool!  The sentence  x -: #@:$ ,:^:(x 
-~ #@:$y) y  is a tautology, no matter whether  x -~ #@:$ y  is positive, 
negative, or zero!
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to