This breaks existing uses of under, which means that you would need a
different token (or word) to represent structural under.

And, if you're doing that, it would make sense to define a new word to
represent "structural under".

But, also, this gets into issues of rank and depth and what is
intended in contexts where those are significant. An easy
implementation would assume that if su is structural under that in u
su v y, that u is rank 0, that structural manipulations of by v only
happen at depth 0.

Meanwhile, an implementation of structural under which requires that
v^:_1 be a dyad such that the x argument to v^:_1 was the original y
passed to u su v .... well, that could be fully general, but the
resulting code would tend to be... obscure (or: not particularly
general) even for simple cases.

I am not making any recommendations here, I am just trying to
characterize the issues which I have noticed.

Take care,

-- 
Raul

On Mon, Jul 26, 2021 at 5:20 PM Elijah Stone <[email protected]> wrote:
>
> On Mon, 26 Jul 2021, Raul Miller wrote:
>
> > I think that the problem here would be in defining vu to work in your  
> > examples.
>
> I definitely don't think that's the problem!
>
> Here are some definitions; untested, but hopefully illustrative:
>
> ',':   $@>@{. $ >@{:
> '{.':  >@{: , }.@>@{.
> '}.':  {.@>@{. , >@{:
>
>   -E
>
> PS. I am no longer certain about the dyadic case.  I'm not sure if it can
> work the way I originally proposed it; I think it might work given
> knowledge of u, but am not certain of that either.
>
> > If you could do that, I think you would have something.
> >
> > Without that, though, we would need a different approach.
> >
> > Thanks,
> >
> > --
> > Raul
> >
> > On Mon, Jul 26, 2021 at 3:57 PM Elijah Stone <[email protected]> wrote:
> >>
> >> 'Structural under' is an extension to under (&. &.:) that allows it to
> >> operate on otherwise uninvertible structure-changing verbs.  It is
> >> implemented in dzaima/apl (https://github.com/dzaima/APL/).
> >>
> >> For example:
> >>
> >>     -&.{. 1 2 3 4  NB. take the head, negate it, reaffix it to the rest of
> >> the body
> >> _1 2 3 4
> >>     }:&.}. 1 2 3 4 NB. remove the head, remove the tail, and then sew the
> >> head back on
> >> 1 2 3
> >>     |:&.}. i.4 3   NB. remove the head, transpose the body, and then
> >> reattach the head
> >> 1 2  3
> >> 3 6  9
> >> 4 7 10
> >> 5 8 11
> >>    |.&., i.2 3     NB. ravel, reverse, and then unravel
> >> 5 4 3
> >> 2 1 0
> >>
> >> To make this functionality available to users, I suggest using .: for
> >> 'assign under', by analogy to :. and ::.  Then:
> >>
> >>   u&.:(v .: vu) y  ←→  vu y;u v y.
> >> x u&.:(v .: vu) y  ←→  vu x;y;(v x) u v y
> >>
> >> The reason that vu is only applied monadically is to allow for the
> >> expected identity:
> >>
> >> u&.:(m&(v .: vu)) y ←→ m vu y;u v y
> >>
> >> Thoughts?
> >>
> >>   -E
> >> ----------------------------------------------------------------------
> >> 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