Similar performance, slightly different idea.
Just apply one i. atop another i. :
pair7=: [: ; (,. i.)&.>@i.
ts=: 6!:2 , 7!:[EMAIL PROTECTED]
(pair3 -: |."[EMAIL PROTECTED]) 3
1
10 ts 'pair3 1000'
0.0230365 9.63603e6
10 ts 'pair7 1000'
0.0210638 9.63603e6
> From: Arie Groeneveld <[EMAIL PROTECTED]>
>
> Slower , but more concise
>
> pair3=:[:;<@({.,.}.)[EMAIL PROTECTED]
>
>
> Arie Groeneveld schreef:
> > pair2=:([:;],."0 _&.>[:<\.1&+)@i.@<:
> >
> > (pair2-:pairi) 100
> > 1
> >
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm