Roger's code will be faster if you only want the lengths.
If you want the actual words too:
   ]r3=: <@-.&' '"1 r2
+------+--------+-----+-------+--------+------+
|shan't|shanghai|shank|shannon|shantung|shanty|
+------+--------+-----+-------+--------+------+
Or
   ]r3=: (' '&~: <@#"1 ]) r2
+------+--------+-----+-------+--------+------+
|shan't|shanghai|shank|shannon|shantung|shanty|
+------+--------+-----+-------+--------+------+

    6=#&> r3
1 0 0 0 0 1

   (] >@#~ 6=#&>) r3
shan't
shanty

> -----Original Message-----
> From: [email protected] [mailto:programming-
> [email protected]] On Behalf Of Roger Hui
> Sent: Tuesday, 17 February 2009 12:04
> To: Programming forum
> Subject: Re: [Jprogramming] Apostrophe's .. Open Quote
> 
> You can just work directly with the matrix if your
> data is already a matrix.  e.g.
> 
>    r2
> shan't
> shanghai
> shank
> shannon
> shantung
> shanty
>    $r2
> 6 22
>    6=+/"1 ' '~:r2
> 1 0 0 0 0 1
> 
> 
> 
> ----- Original Message -----
> From: David Vincent-Jones <[email protected]>
> Date: Monday, February 16, 2009 14:39
> Subject: Re: [Jprogramming] Apostrophe's .. Open Quote
> To: Programming forum <[email protected]>
> 
> > Looking again at this there is a slight problem:
> >
> > In my example my text shape is 6 22 while yours is 138 (with embedded
> > CRs) ... but I guess I can solve that by appending CRs to the entire
> > block. That works but kinda messy!
> >
> > David
> >
> > On Tue, 2009-02-17 at 10:43 +1300, Sherlock, Ric wrote:
> > > eg=: 0 : 0
> > >
> > shan't
> > >
> > shanghai
> > >
> > shank
> > >
> > shannon
> > >
> > shantung
> > >
> > shanty
> > > )
> ----------------------------------------------------------------------
> 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