I am happy and not surprised. I get the indices
of the sought scalar numbers (as required) in any rank arrays.

   i. 2 2 3
0  1  2
3  4  5

6  7  8
9 10 11
   (i. 2 2 3)  ([EMAIL PROTECTED] #: i.&,)  1 4 7 10
0 0 1
0 1 1
1 0 1
1 1 1
   (i. 2 2 3)  ([EMAIL PROTECTED] #: i.&,)  0 4 8
0 0 0
0 1 1
1 0 2

   (i. 3)  ([EMAIL PROTECTED] #: i.&,)  0 1
0
1
   (i. 3 3 3 3 3)  ([EMAIL PROTECTED] #: i.&,)  0 1
0 0 0 0 0
0 0 0 0 1


--- Dan Bron <[EMAIL PROTECTED]> wrote:

> 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
> 



 
____________________________________________________________________________________
Never miss an email again!
Yahoo! Toolbar alerts you the instant new Mail arrives.
http://tools.search.yahoo.com/toolbar/features/mail/
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to