Sorry. Correction in the second paragraph: 'function chains'. Though some
of the combinators can naturally be used in trains.
On 9 Feb 2016 8:59 pm, "Matthew Baulch" <[email protected]> wrote:

> Suppose I wish to construct a complex, non-regular deeply nested
> structure: to model some inherently non-linear system. A natural approach
> (for me, anyhow) is to construct a library of combinators, or a domain
> specific language, with which to specify the (boxed) structure.
>
> J rises easily to the task, and before long I'm looking at long function
> trains of the form
>
> myStruct =: c0 p0 c1 p1 c2 p2 ... cN pN
>
> where the ci are (combinator) verbs, and the pj are (parameter) nouns.
> Nice. Easy.
>
> Only trouble is, N may be large and J prefers such statements to sit on a
> single line. Correct? I can split my definition:
>
> msPartA =. .....
> msPartB =. .....
> .....
> msPartX =. .....
> myStruct =: msPartA msPartB .... msPartX
>
> though this feels awkward. The most obvious issue is that the PartA, ...,
> PartX are distracting; unless of course I can find a natural way of
> splitting and naming them. Ideally, the parts should be as close to a
> comfortable line width as possible. Again, awkward. If myStruct1 and
> myStruct2 have the same partitioning scheme but myStruct2 (for instance) is
> much larger than myStruct1, there will be many sparsely, or many
> overpopulated lines. Awkward too.
>
> I love J. It handles complex regular data so elegantly. How can I bring
> similar elegance to irregular data? Can my combinators be rescued, or
> should I use another approach?
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to