In general it is not, unfortunately:

   $4 5 6 7(=/)&i. 3 
4 5 6 7 3

   $4 5 6 7|:@(=/)&i. 3 
3 7 6 5 4

   $4 5 6 7(=/~)&i. 3 
3 4 5 6 7

In this example the use of |:@ is superb since the rank 1 axis (of the
strings which should be searched) becomes the leading one of the items of
the result.


R.E. Boss


> -----Oorspronkelijk bericht-----
> Van: [email protected] [mailto:programming-
> [email protected]] Namens Henry Rich
> Verzonden: vrijdag 19 augustus 2011 23:55
> Aan: Programming forum
> Onderwerp: Re: [Jprogramming] Search for ordered letters within lines of
> matrix
> 
> Lovely...  note that |:@(=/)  is the same as   (=/~)
> 
> Henry Rich
> 
> On 8/19/2011 12:34 PM, R.E. Boss wrote:
> > OK, convinced,  Shaws solution doesn't handle equal neighbors well.
> > But this design flaw is easily repaired (without loss of elegance or
> > performance):
> >
> >     findinRows_SB=: +./@((*. 1 |.!.0 +./\.)/@|:@(=/))
> >
> >
> A=:'CTGGTTGAT','GTAGTCATA','CATGTCTAA','TCGAAAGTT',:'CCGGAGAAG'
> >
> >    A findinRows_SB 'TAA'
> > 0 1 1 1 0
> >    A findinRows_SB 'TAAG'
> > 0 0 0 1 0
> >
> >     findinRows_ML=: [: *@#@>  [: ([ #~ (<  {:))&.>/<@I.@(=/~)
> >
> >    A findinRows_ML 'TAA'
> > 0 1 1 1 0
> >    A findinRows_ML 'TAAG'
> > 0 0 0 1 0
> >
> >
> > R.E. Boss
> >
> >


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to