On 2/6/08, Roger Hui <[EMAIL PROTECTED]> wrote:
> > That said, I wish J had special code for something like
> > ssndx=: ([:;({.<@:[EMAIL PROTECTED]:)"1)@[ {]
> > with a two column numeric right argument and perhaps
> > ssdir=: I.@(e.{.) ,. #;.1
>
> Have you looked at f;.0 ? (And did you mean a two column numeric
> LEFT argument?)
Actually, I did mean a two column left argument. Thanks.
And, you are also correct, that I could define
ssndx=: [: ; ,"[EMAIL PROTECTED] <;.0 ]
and that seems to be somewhat faster than the code I
had posted previously, for the case I tested:
txt=: 1e6$'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
dir=: ? 1e4# ,:9e5 30
ssndx0=: ([:;({.<@:[EMAIL PROTECTED]:)"1)@[ {]
ssndx1=: [: ; ,"[EMAIL PROTECTED] <;.0 ]
dir (ssndx0 -: ssndx1) txt
1
(6!:2,7!:2) 'dir ssndx0 txt'
0.0227303 2.57824e6
(6!:2,7!:2) 'dir ssndx1 txt'
0.0156492 2.52966e6
But I imagine further improvements are possible.
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm