A natural generalization of [EMAIL PROTECTED] #: i.& for non-scalar
right arguments, can be done by specifying the sought 
argument rank, which also provides flexibility and 
removes ambiguity between multi-cell arguments or 
single cell argument.

   (i.2 2 3) ([EMAIL PROTECTED] #: i.&,)&:(<"0)  6 7 8,:9 10 11
1 0 0
1 0 1
1 0 2
1 1 0
1 1 1
1 1 2
   (i.2 2 3) ([EMAIL PROTECTED] #: i.&,)&:(<"1)  6 7 8,:9 10 11
1 0
1 1
   (i.2 2 3) ([EMAIL PROTECTED] #: i.&,)&:(<"2)  6 7 8,:9 10 11
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
> 



 
____________________________________________________________________________________
Looking for earth-friendly autos? 
Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center.
http://autos.yahoo.com/green_center/
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to