I think I would use
   F=: +./@E."1 S:0

   'ab' F 'abcd'
1
   'ab' F ;:'abcd defg zabc'
1 0 1
   'ab cd ef' F&;: 'abcd defg zabc'
1 0 0

-- 
Raul

On Fri, Nov 11, 2011 at 2:19 PM, Kip Murray <[email protected]> wrote:
> Verb f below is an example of "Subtle J".  Is there a "Simple J" way?
>
> I first saw verb f in a note from Linda Alvord.
>
>    f=: 13 :'x&(+./@E.)&>y'
>
>    'bc' f 'a bc def';'ab cde f';'abc d ef'
> 1 0 1
>
> As you see, f tells which strings on the right contain the left string.
>
> Experienced J users know that f operates by first forming the verb
> x&(+./@E.)&> and then applying that verb to y .  They also know "that
> verb" will be applied to each box in y independently of the others and
> the separate results assembled into the final answer.
>
> Is there a way to do it using mostly trains and rank?  A "Simple J" way
> for less experienced users?
>
> You hear the plea of an ex college teacher who dealt with less
> experienced users!
>
> ----------------------------------------------------------------------
> 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