ssndx2=: 4 : 0
 'i m'=. |: x
 ((m#i-+/\}:0,m)+i.+/m){y
)

ts=: 6!:2 , 7!:[EMAIL PROTECTED]

   dir (ssndx1 -: ssndx2) txt
1
   ts 'dir ssndx0 txt'
0.0258248 2.59885e6
   ts 'dir ssndx1 txt'
0.0151236 2.55955e6
   ts 'dir ssndx2 txt'
0.00634208 4.85344e6



----- Original Message -----
From: Raul Miller <[EMAIL PROTECTED]>
Date: Wednesday, February 6, 2008 15:42
Subject: Re: [Jprogramming] Beginner--more questions about textual data handling
To: Programming forum <[email protected]>

> 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.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to