[Jprogramming] Linking boxed strings with intervening spaces
R.E. Boss
r.e.boss at planet.nl
Tue Jan 3 00:19:35 HKT 2012
;z,.<' '
alpha bravo charlie
but gives an extra space at the end
R.E. Boss
> -----Oorspronkelijk bericht-----
> Van: programming-bounces at jsoftware.com [mailto:programming-
> bounces at jsoftware.com] Namens Ian Clark
> Verzonden: maandag 2 januari 2012 16:35
> Aan: Programming forum
> Onderwerp: [Jprogramming] Linking boxed strings with intervening spaces
>
> 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
More information about the Programming
mailing list