Here is a version of the same idea but with less boxing. Interestingly it
looks as though J9 will support the specifying indices using unboxed arrays
which would simplify this further!
load 'stats'
((0 1,:1 2) {~ permrep 2) (0&{::@]) `(<@:(<"1)@[)`(1&{::@]) }"2 _ w;i
abO
cdR
MNO
Mab
Pcd
MNO
MNO
abR
cdO
MNO
Pab
Mcd
On Tue, Feb 19, 2019 at 11:33 AM 'robert therriault' via Programming <
[email protected]> wrote:
> Hi Brian,
>
> My comments about boxing had more to do with all the boxing that needed to
> be done and then undone to get the right result.
>
> A couple of examples.
>
> (<"0 ind) to me just looks messy especially when it is already boxed, but
> the each/every adverb requires that.
>
> (< cmb) to just unpack it later in the gerunds feels weak as well, but
> seems to be necessary because opening the boxes causes w to be padded out
> to match i. So we open what we have double boxed and open again later
> inside the gerunds after we have selected the particular box. Just feels
> messy to me.
>
> Lots more to learn :-)
>
> Cheers, bob
>
> > On Feb 18, 2019, at 2:15 PM, Brian Schott <[email protected]>
> wrote:
> >
> > Bob,
> >
> > Yes. That's what I wanted.
> > I'm not completely sure about your comment about the necessity of boxing
> > and unboxing, though.
> > I changed your each to every and got an unboxed result just like the
> result
> > you gave, but I think your comment is deeper and I want to think more
> about
> > it.
> >
> > I especially want to ponder how you got around the problem I had earlier:
> > My first choice was to have just a single amend of the form r=: i m}"2 w
> > where
> > m =. combis<"1@:{2<\i. 3 NB. (your name for m is ind)
> > Maybe instead of i and w I could use I and W in r =: I m}"2 W
> > where I and W are respectively I=:4 copies i and W=:4 copies w (where
> > copies =: $ ,:) .
> > But that hasn't worked for me because the atoms in m apply to ALL items
> of
> > i and w or I and W, rather than to just the I and W items in their
> > respective, individual boxed index pairs. Maybe that's the part that you
> > are talking about when you mention the requirement for boxing and
> unboxing?
> >
> > Raul,
> > I was really composing a response to you when Bob's response appeared,
> and
> > much of paragraph above which begins "I especially want ..." was being
> > drafted to you. So perhaps, you can better understand where I was coming
> > from.
> >
> > I got stuck trying to test your example j excerpts because of spelling
> > errors on the core of the excerpt:
> > 2 :’m y}n’”2
> > |spelling error
> > | 2 :’m y}n’”2
> > | ^
> >
> > Thanks a bunch to both of you,
> > ----------------------------------------------------------------------
> > 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