nice, can kind of work for odd rows too: (1 1;1 2) ,(L:0) _2[\ <"1 i.4 4 ┌─────────────┬───────────────┐ │1 1 0 1 2 3 │1 1 4 5 6 7 │ ├─────────────┼───────────────┤ │1 2 8 9 10 11│1 2 12 13 14 15│ └─────────────┴───────────────┘
or (1 1;1 2) ,(L:0) |: _2[\ <"1 i.4 4 ┌───────────┬───────────────┐ │1 1 0 1 2 3│1 1 8 9 10 11 │ ├───────────┼───────────────┤ │1 2 4 5 6 7│1 2 12 13 14 15│ └───────────┴───────────────┘ (1 1;1 2) ,(L:0) _3[\ <"1 i.5 4 ┌───────────────┬───────────────┬─────────────┐ │1 1 0 1 2 3 │1 1 4 5 6 7 │1 1 8 9 10 11│ ├───────────────┼───────────────┼─────────────┤ │1 2 12 13 14 15│1 2 16 17 18 19│1 2 │ └───────────────┴───────────────┴─────────────┘ ________________________________ From: R.E. Boss <[email protected]> To: [email protected] Sent: Monday, November 3, 2014 9:35 AM Subject: Re: [Jprogramming] shorter way to prefix lines altenatively? ;('A:';'B:'),L:0 "1 [_2[\<;.2 t A:abc B:defg A:hijkl B:erws A:opqow B: A:sdfsdf B:dofi R.E. Boss (Add your info to http://www.jsoftware.com/jwiki/Community/Demographics ) > -----Original Message----- > From: [email protected] [mailto:programming- > [email protected]] On Behalf Of Roger Hui > Sent: maandag 3 november 2014 13:01 > To: Programming forum > Subject: Re: [Jprogramming] shorter way to prefix lines altenatively? > > ; ((('A:';'B:') $~ #) ,&.> ]) <;.2 t > > On Mon, Nov 3, 2014 at 3:50 AM, June Kim (김창준) <[email protected]> > wrote: > > > Hello > > > > > > I am looking for a shorter and more elegant way to do the following given a > > string t: > > > > t=. 0 :0 > > > > abc > > > > defg > > > > hijkl > > > > erws > > > > opqow > > > > > > sdfsdf > > > > dofi > > > > ) > > > > ,&:>/ ,(,.~ ('A:';'B:') $~ #) ,.<;. 2 t > > > > A:abc > > > > B:defg > > > > A:hijkl > > > > B:erws > > > > A:opqow > > > > B: > > > > A:sdfsdf > > > > B:dofi > > ---------------------------------------------------------------------- > > For information about J forums see > http://www.jsoftware.com/forums.htm > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
