The verb m} has two different definitions, one gets used for contexts that look like m} y and the other gets used for contexts that look like x m} y. I wanted to use the dyadic definition, but did not have a meaningful value for x, so I used ~ (giving the effect of y m} y).
Meanwhile, if you need to deal with heterogeneous data, you might consider using different names to hold the different pieces, rather than putting it all in one array. The distinction is largely a matter of taste, of course, but from my point of view simplicity is a virtue. Does this help? Thanks, -- Raul On Fri, Sep 20, 2013 at 4:42 PM, Pascal Jasmin <[email protected]> wrote: > Thank you Raul. I don't understand the use of '~' here. > > To answer your remark about boxes, the data could have looked like: > > 1 3:`2:`]}~&.>@{`1:`]} (<"1 &. |: i. 5 3), <'ABCDE' > ┌──────────┬───────────┬───────────┬─────┐ > │0 3 6 9 12│1 4 3 10 13│2 5 8 11 14│ABCDE│ > └──────────┴───────────┴───────────┴─────┘ > > The data can represent 4 columns with each contained list item corresponding > to 1 row of data. > > '~' if I follow, is evoke reversed y u x. If it is removed, the sentence > returns 7 which is the original value that 3 replaces. So, it is being > called with x and y 1 and 7 (reversed). Why that works especially with right > gerund getting 1 instead of 7 is hard for me to guess. > > > changing the middle select verb form [ to 1: and left "new" verb from 3: to > 3"_ produces > > 1 (3"_)`2:`]}~&.>@{`[`]} (<"1 &. |: i. 5 3), <'ABCDE' > ┌──────────┬───────────┬───────────┬─────┐ > │0 3 6 9 12│1 4 3 10 13│2 5 8 11 14│ABCDE│ > └──────────┴───────────┴───────────┴─────┘ > 1 3("_)`2:`]}~&.>@{`1:`]} (<"1 &. |: i. 5 3), <'ABCDE' > ┌───────────┐ > │1 4 7 10 13│ > └───────────┘ > > though changing each to L:0 allows both forms. > > 1 (3"_)`2:`]}~(L:0)@{`1:`]} (<"1 &. |: i. 5 3), <'ABCDE' > ┌──────────┬───────────┬───────────┬─────┐ > │0 3 6 9 12│1 4 3 10 13│2 5 8 11 14│ABCDE│ > └──────────┴───────────┴───────────┴─────┘ > > > > > ----- Original Message ----- > From: Raul Miller <[email protected]> > To: Programming forum <[email protected]> > Cc: > Sent: Friday, September 20, 2013 4:00:10 PM > Subject: Re: [Jprogramming] Amend trickiness part 2 > > As a general rule, I prefer to avoid thinking about boxes. > > In my opinion, either (a) boxes should be avoided, or (b) box > boundaries should correspond to definitional boundaries. (It seems > wrong, to me, to have such a clear declaration of modularity and not > express it in the language I am building). > > That said, here's what I think you might be asking for: > > 1 3:`2:`]}~&.>@{`[`]} <"1 |: i. 5 3 > +----------+-----------+-----------+ > |0 3 6 9 12|1 4 3 10 13|2 5 8 11 14| > +----------+-----------+-----------+ > > Still... for these numbers, I think I'd much prefer something like: > > |:3 (<2 1)} i.5 3 > 0 3 6 9 12 > 1 4 3 10 13 > 2 5 8 11 14 > > (It's just so much easier when you're working at the right level of > abstraction.) > > Thanks, > > -- > Raul > > On Fri, Sep 20, 2013 at 3:46 PM, Pascal Jasmin <[email protected]> wrote: >> >> >> instead of: >> >> (3) (2)} L:0 (1}) |: <"1 |: i. 5 3 >> ┌───────────┐ >> │1 4 3 10 13│ >> └───────────┘ >> >> I'd like: >> >> ┌──────────┬───────────┬───────────┐ >> │0 3 6 9 12│1 4 3 10 13│2 5 8 11 14│ >> └──────────┴───────────┴───────────┘ >> >> >> >> >> ----- Original Message ----- >> From: Raul Miller <[email protected]> >> To: Programming forum <[email protected]> >> Cc: >> Sent: Friday, September 20, 2013 3:40:38 PM >> Subject: Re: [Jprogramming] Amend trickiness part 2 >> >> On Fri, Sep 20, 2013 at 3:37 PM, Pascal Jasmin <[email protected]> >> wrote: >>> I would have hoped that the right approach was: >>> >>> 3 [L:0(2})`1:`]} |: <"1 |: i. 5 3 >>> ┌─┐ >>> │3│ >>> └─┘ >>> >>> but no. >> >> I've lost track of your goal. >> >> Thanks, >> >> -- >> Raul >> ---------------------------------------------------------------------- >> 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 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
