Dissect will show you that g fails because it is being applied to between two boxes; not in the domain of *.

Try this:

   +`*/ 1 3 10
31

It's equivalent to

  1 + 3 * 30

Henry Rich

On 2/11/2016 7:05 AM, Linda A Alvord wrote:
Henry, I got a few days behind in email and I can't figure out your line:

f=:,
    g=:,.
    h=:|.
      f`g`h/'cat';'dog';''
┌───┬───┬─┐
│cat│dog│ │
└───┴───┴─┘
f=:+:
    g=:*:
    h=:%:
    f`g`h/3;6;9
    f`g`h/3;6;9
|domain error: g
|       f`g`h/3;6;9

Linda
-----Original Message-----
From: Programming [mailto:[email protected]] On Behalf 
Of Henry Rich
Sent: Tuesday, February 9, 2016 7:44 AM
To: [email protected]
Subject: Re: [Jprogramming] Nested structures. Idioms? Combinators?

Look at

c0`c1`c2/ p0;p1;p2;''

Henry Rich

On 2/9/2016 4:59 AM, Matthew Baulch 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
----------------------------------------------------------------------
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