(I sort of ignored the empty string case, obviously - in some cases
these conversions would discard them. In others, it would preserve
them. It's something of a judgement call ... somewhat analogous to
forum choice, which I perhaps abused in my previous message.)

-- 
Raul

On Thu, May 26, 2022 at 12:19 PM Raul Miller <[email protected]> wrote:
>
> Here's how I think I'd tackle that "grid":
>
> b2f     ;,&LF&.> b
> b2o     ;:inv b
> b2x     > b
>
> f2b     cutLF f
> f2o     rplc&(LF,' ') f
> f2x     >cutLF f
>
> o2b     cut o
> o2f      rplc&(' ',LF) o
> o2x     >cut o
>
> x2b      <@dtb"1 x
> x2f       ;<@(,&LF)@dtb"1 x
> x2o     deb,' ',. x
>
> FYI,
>
> --
> Raul
>
> On Thu, May 26, 2022 at 11:46 AM Ian Clark <[email protected]> wrote:
> >
> > Henry wrote:
> > > The problem was with the form
> > [&.>@:(<"0) 'ab'
> > (used in x2b).
> >
> > x2b is defined as:
> >    [: (#~ ([: +./\. ' '&~:))&.> <"1
> > so I guess that was a typo. But I get the idea.
> >
> > So… no need for me to make any changes to 'format/zulu' just yet.
> >
> > ASIDE:
> > --but when I do, I'll throw away the entire implementation.
> >
> > Zulu addresses an enduring need for the J beginner wanting to develop code
> > for distribution. But it's deprecated for operational use.
> >
> > Zulu is an awful example of the edge-case 'tail' wagging the JAL 'dog'.
> >
> > If we ever get a *usable* addon, or a primitive (?), which comprehensively
> > supports dictionaries, or even just collections of strings, then I hope &
> > pray it eats Zulu for breakfast.
> >
> >
> > Zulu's aims could be met by publishing a 4x4 grid of recommended
> > *consistent* conversions between the 4 common "strings" formats:
> >
> > b - boxed
> >
> > f - LF-separated
> >
> > o - open
> >
> > x - matrix
> >
> > See the lab: Strings conversion package.
> >
> >
> > WHAT'S MORE:
> >
> > A user-facing app doing smart things with LF-separated strings must adopt a
> > policy towards final LF, especially for handling a collection of substrings
> > containing 0 or 1 members.
> >
> > Zulu adopts the wrong policy. And pays for it with lots of slow edge-case
> > code.
> >
> > On Wed, 25 May 2022 at 18:24, Henry Rich <[email protected]> wrote:
> >
> > > Fixed for next beta.  The problem was with the form
> > >
> > > [&.>@:(<"0) 'ab'
> > >
> > > (used in x2b).  The <"n created virtual blocks but erroneously flagged
> > > them as inplaceable.
> > >
> > > Workaround: replace (<"n) with (<"<"n).
> > >
> > > Henry Rich
> > >
> > > On 5/24/2022 8:25 PM, Ian Clark wrote:
> > > > Note: Addon 'format/zulu' does not crash 903 or earlier.
> > > >
> > > >
> > > >     JVERSION
> > > >
> > > > Engine: j904/j64/darwin
> > > >
> > > > Beta-d: commercial/2022-05-19T20:41:44
> > > >
> > > > Library: 9.04.01
> > > >
> > > > Qt IDE: 2.0.3/6.2.4(6.2.4)
> > > >
> > > > Platform: Darwin 64
> > > >
> > > > Installer: J904 install
> > > >
> > > > InstallPath: /applications/j904
> > > >
> > > > Contact: www.jsoftware.com
> > > >
> > > >
> > > > Addon 'format/zulu' is required by various addons, notably math/tabula.
> > > >
> > > > If loaded directly or indirectly by your ~config/startup.ijs
> > > >
> > > > then JQt will terminate without showing output.
> > > >
> > > >
> > > > jconsole will terminate also, but gives a briefer, clearer crash report:
> > > >
> > > >
> > > > jconsole(2607,0x104ba4580) malloc: *** error for object 0x138091fc0:
> > > > pointer being freed was not allocated
> > > >
> > > > jconsole(2607,0x104ba4580) malloc: *** set a breakpoint in
> > > > malloc_error_break to debug
> > > >
> > > > zsh: abort      /Applications/j904/bin/jconsole
> > > >
> > > >
> > > > Saving session...
> > > >
> > > > ...copying shared history...
> > > >
> > > > ...saving history...truncating history files...
> > > >
> > > > ...completed.
> > > >
> > > >
> > > > [Process completed]
> > > >
> > > >
> > > > The crash is caused by execution of a verb: zutest_zulu_ .
> > > >
> > > > This verb gets executed as the final step in loading addon 'format/zulu'
> > > .
> > > > It contributes nothing to the functionality of this suite of string
> > > > utilities, but gives all the working verbs a thorough test.
> > > >
> > > >
> > > > I hope to find out why it crashes before the weekend. Meanwhile, here is
> > > a
> > > > workaround.
> > > >
> > > > It won't affect the operational behavior of the addon, but it's like
> > > > turning off the fire alarms.
> > > >
> > > > Launch either jqt or jcon (any recent version)…
> > > >
> > > >
> > > > STEP 1
> > > >
> > > > open'~addons/format/zulu/zutest.ijs'
> > > >
> > > >
> > > > STEP 2
> > > >
> > > > Comment-out lines 64-66:
> > > >
> > > >
> > > > ok1=. ;  0 zutest each ;:'zu z1 z0'
> > > >
> > > > ok2=. ;0j1 zutest each ;:'zu z1 z0' NB. for conversions: a2*
> > > >
> > > > ZUTEST_z_=: ok1 , ok2
> > > >
> > > >
> > > > STEP 3
> > > >
> > > > Save the updated script.
> > > >
> > > >
> > > > Now you can triger the crash at will in either JQt or jcon like this:
> > > >
> > > >
> > > > load 'format/zulu' NB. should not crash now
> > > >
> > > > 0 zutest 'zu'      NB. crashes
> > > > ----------------------------------------------------------------------
> > > > For information about J forums see http://www.jsoftware.com/forums.htm
> > >
> > >
> > > --
> > > This email has been checked for viruses by AVG.
> > > https://www.avg.com
> > >
> > > ----------------------------------------------------------------------
> > > 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

Reply via email to