Here's how I'd implement the overlapped block thing.

overlapblock=:2 :0
:
  'size overlap init'=. x
  bs=. size*i.>.(#y)%{.size
  bl=. bs-~(#y)<.bs+size+overlap
  accum=. init
  for_sl. bs,.bl do.
    accum=. accum u v ((+i.)/sl){y
  end.
)

   #(10;9;i.0 0) ~.@, overlapblock (~.@(9&(]\))) 30$'abcdefghij'
10

Of course change the value for x and y to match what you want to do...
And maybe recode to swap u and v, if that looks better.

If that's too slow, it might be better to gather intermediate results
from each block and then post-process them in a single pass?

Thanks,

-- 
Raul

On Tue, Feb 3, 2015 at 6:24 PM, Joe Bogner <[email protected]> wrote:
> On Tue, Feb 3, 2015 at 6:17 PM, Raul Miller <[email protected]> wrote:
>> So you are working with non-overlapping infixes?
>>
>>    _9[\'abcdefghijklmnopqrstuvwxyz'
>> abcdefghi
>> jklmnopqr
>> stuvwxyz
>>
>
>
> Sorry, no that was a typo. I can use non-overlapping to split up into
> blocks, but I need overlapping for the string.
>
> It is overlapping infixes as I am calculating the unique 9 character 
> substrings
>
> 9[\abc
> abcdefghi
> bcdefghij
> cdefghijk
> defghijkl
> efghijklm
> fghijklmn
> ghijklmno
> hijklmnop
> ijklmnopq
> jklmnopqr
> klmnopqrs
> lmnopqrst
> mnopqrstu
> nopqrstuv
> opqrstuvw
> pqrstuvwx
> qrstuvwxy
> rstuvwxyz
>
> # ~. 9[\abc
> 18
> ----------------------------------------------------------------------
> 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