What you want is "infix":

   2 <\ 3 1 4 1 5 9
┌───┬───┬───┬───┬───┐
│3 1│1 4│4 1│1 5│5 9│
└───┴───┴───┴───┴───┘
   2 -/\ 3 1 4 1 5 9
2 _3 3 _4 _4




On Fri, Aug 14, 2015 at 7:30 AM, Yoel Jacobsen <[email protected]>
wrote:

> Lately, I find myself repeatedly comparing pairs in arrays.
>
> I usually do something like:
>
> d =: 3 : '-/"1 }. y ,. 0 , }: y'
>
>
> d i. 5
>
> 1 1 1 1
>
>
> It feels like I'm reinventing the wheel but I couldn't find a simpler way
> (and more efficient for large arrays) to apply u over each pair of v.
>
>
> Is there a better way?
>
>
> Yoel
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to