Another variation using the joinstring verb from the strings script. punct=: '-';'/';CRLF ;<@joinstring"1 punct ((,~ each 1 0 3{ ]))"1 q
or ; punct <@([: joinstring [ ,~ each 1 0 3 { ])"1 q On Wed, Aug 10, 2011 at 1:56 PM, Ric Sherlock <tikk...@gmail.com> wrote: > This will give you the same result (list of boxes) as Henry's initial > suggestion: > punct <@(;@(, each 1 0 3{ ]))"1 q > > A slight addition to Henry's 2nd bit of code will give you a string of > CRLF separated lines: > ;,&CRLF&.> punct <@(;@(, each 1 0 3{ ]))"1 q > > It's overkill for this but the addon tables/dsv can be useful for this > sort of stuff: > require 'tables/dsv' > ('';'') makedsv punct ((, each 1 0 3{ ]))"1 q > Johnson Controls-JCI/197412020000 > Juniper Networks-JNPR/200910290930 > Kellogg Co-K/195905120000 > Kohl"s Corp-KSS/199205190000 > Koninklijke Philips Electronics-PHG/198704140000 > Kraft Foods-KFT/200106130945 > LSI Corp-LSI/198910020000 > LeapFrog Enterprises-LF/200207250950 > Leggett & Platt-LEG/197906250000 > > > On Wed, Aug 10, 2011 at 1:14 PM, PackRat <pack...@anet.com> wrote: >> bob therriault wrote: >>> I took a similar approach to Henry, but created a left argument >>> first and then made the verb a dyad >>> >>> punct =: '';'-';'/' >>> punct (;@(, each 1 0 3{ ]))"1 q >> >> Any suggestions as to how to get rid of the terminating spaces in each >> line prior to output? In other words, the output file should contain >> ONLY the text of each line, but not the terminating spaces, resulting >> in ragged (variously-lengthed) lines to write to a file. (Right now, >> when I write your data to an output file, it contains all those extra >> space-wasting spaces at the end of each line of text.) Yeah, I could >> write the code of the scripting language I use to automate a commercial >> application (the next step in my process) to trim those spaces as I >> read in the data, but that really shouldn't be necessary for data >> coming out of a language like J. Thanks in advance for any suggestions >> you can make along this line! >> >> >> Harvey >> >> ---------------------------------------------------------------------- >> For information about J forums see http://www.jsoftware.com/forums.htm >> > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm