Warming to the theme, this gets us close... 5!:6 <'Z' <;._1 ' alpha bravo charlie'
Apart from its curiosity value, it has problems. For a start it's no faster than ;:inv . Plus it takes a pronoun, not a noun, although you can get away with using 'y' in an explicit definition: foo=: 3 : '8 }. }: 5!:6 <''y''' foo Z alpha bravo charlie On Tue, Jan 3, 2012 at 1:47 AM, Linda Alvord <lindaalv...@verizon.net> wrote: > The example here replaces the space between words with | > > Z=: ;:'alpha bravo charlie' > Z > ┌─────┬─────┬───────┐ > │alpha│bravo│charlie│ > └─────┴─────┴───────┘ > b2o=: [:}. [: ; ' ' ,&.> ] > b2o > [: }. [: ; ' ' ,&.> ] > > $b2o Z > alpha bravo charlie > $b2o Z > 19 > _1 _1}.":Z > ┌─────┬─────┬─────── > │alpha│bravo│charlie > > ,1 1}._1 _1}.":Z > alpha│bravo│charlie > > $,1 1}._1 _1}.":Z > > This doesn't remove the | between words. However it is interesting because > it illustrates how the boxes are constructed! > > Linda > > -----Original Message----- > From: programming-boun...@jsoftware.com > [mailto:programming-boun...@jsoftware.com] On Behalf Of Raul Miller > Sent: Monday, January 02, 2012 11:26 AM > To: Programming forum > Subject: Re: [Jprogramming] Linking boxed strings with intervening spaces > > The initial transcript should have been: > > Z=: ;:'alpha bravo charlie' > > ;:inv Z > alpha bravo charlie > > }.;' ';"1,.Z > alpha bravo charlie > > 9!:7]11#' ' > > ,1 1}._1 _1}.":Z > alpha bravo charlie > > My gmail induced formatting errors are seriously making me reluctant > to use email. > > -- > Raul > > On Mon, Jan 2, 2012 at 11:21 AM, Raul Miller <rauldmil...@gmail.com> wrote: >> Z=: ;:'alpha bravo charlie' >> ;:inv Zalpha bravo charlie }.;' ';"1,.Z >> alpha bravo charlie >> 9!:7]11#' ' >> ,1 1}._1 _1}.":Z >> alpha bravo charlie >> >> I think ;:inv is the closest you are going to get to a single >> primitive version. There are probably too many worthwhile >> possibilities for alternatives (newlines should terminate, commas >> should separate, bullets should prefix, ...) for other the >> alternatives to be single-primitive >> >> That said, I do wish that L: would turn constants into verbs the same >> way that "_ does: >> >> ;}.,', ';"1 ,.Z >> alpha, bravo, charlie >> ;}.,(,.~ 1 |.!.(<' and ') ', '"_ L:0) Z >> alpha, bravo and charlie >> >> >> -- >> Raul >> >> On Mon, Jan 2, 2012 at 10:35 AM, Ian Clark <earthspo...@gmail.com> wrote: >>> Suppose z is boxed strings, eg z=: ;: 'alpha bravo charlie' >>> >>> I half-recall there's a neater (single-primitive) way to recover the >>> string 'alpha bravo charlie' from z than: >>> >>> b2o=: [: }. [: ; ' ' ,&.> ] >>> b2o z >>> alpha bravo charlie >>> >>> but I've forgotten what it is and can't seem to find it in Voc or Dic. >>> >>> On the page for "Raze" (;) the Dictionary says archly: >>> The fit conjunction (;!.f) provides fill specified by the atom f >>> but AFAICS (;!.' ')z is the same as ;z , viz: 'alphabravocharlie' . >>> >>> Nor incidentally is (;) listed as such on the page for "Fit" (!.) . >>> >>> I observe however that: >>> ;:inv z >>> alpha bravo charlie >>> >>> But what's in my mind is a way of interleaving some other letter, or 2 >>> spaces, or comma-space, etc. >>> >>> BTW timer (6!:2) tells me that ;:inv is slower than b2o . >>> ---------------------------------------------------------------------- >>> 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