You could do it iteratively using "power" but I'm not sure how expensive
this really is.

   longstr=. (]{~?~@:#) 1e6$Alpha_j_
   label=. 'FIND THIS'
   whix=. 200?#longstr
   whix=. whix#~(#label)<2-~/\0,/:~whix
   longstr=. (>(#whix)$<label) (whix+/i.#label)}longstr
   iterFind=: 4 : '((nn+#x)}.>0{y) ; (>1{y),(nn<#>0{y)#nn=. x (E. i. 1:)
>0{y'
   $&.>label iterFind^:_] longstr;''
+-+---+
|0|200|
+-+---+
   $&.>label&iterFind^:(100&([ - [: # [: > 1 { ]))] longstr;''
+------+---+
|531730|100|
+------+---+


On Wed, Oct 12, 2011 at 3:42 PM, Raul Miller <rauldmil...@gmail.com> wrote:

> On Wed, Oct 12, 2011 at 3:32 PM, Ric Sherlock <tikk...@gmail.com> wrote:
> > It may be worth noting that the following is supported by special code
> > and will stop after finding the first occurrence of label in string.
> >    label (E. i. 1:) string
> > If string is long enough relative to the first 100 matches it may be
> > worth iterating this operation 100 times, dropping to after the most
> > recently found label each time.
>
> That would require making 99 extra copies of a string which is too big
> to be worth inspecting.
>
> --
> Raul
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>



-- 
Devon McCormick, CFA
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to