The specification was

> Ok, I'm wondering how I might find the number 4 in a rank-2 array
> using dyadic i.

in the context of novice user.


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


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to