Dyadic gerund amend looks like this x u0`u1`u2} y
and works like this: (x u0 y) (x u1 y)} x u2 y (Monadic gerund amend is very different.) Does that help? Thanks, -- Raul On Wed, Jan 28, 2015 at 12:59 PM, Joe Bogner <[email protected]> wrote: > On Tue, Jan 27, 2015 at 11:45 PM, Raul Miller <[email protected]> wrote: >> I guess this is how I'd write that: >> >> f=: (3##\@])`(,@])`[} 0 1 2 +/~I. >> >> Is that easy enough to read, or should I spell out how it works? >> > > This was enjoyable to decode. It looks simple but there are a few > things that I haven't used extensively. > > I still don't understand the gerund item amend. > > Here is my interpretation for others who may be interested > > * 1. First I realized it's a hook > > I tried using trace and dissect and couldn't figure it out from those > outputs, so then I tried > > (arr f arr) -: (f arr) > 1 > > http://www.jsoftware.com/jwiki/Vocabulary/hook > > * 2. Knowing it was a hook I started to break it down > > The spacing threw me off a bit initially > > NB. gerund amend http://www.jsoftware.com/jwiki/Vocabulary/curlyrt#dyadic > u=: (3##\@])`(,@])`[ } > v=: 0 1 2 +/~I. > > ((u v) arr) -: (f arr) > 1 > > (arr g (v arr)) -: (f arr) > 1 > > * 3. Item Amend > > I haven't yet figured out how this part works > > Here's a simpler version to look at > > (12#0) ((3 # #\@])`(,@])`[}) ((1,2,3),(5,6,7),:(9,10,11)) > 0 1 1 1 0 2 2 2 0 3 3 3 > > > The first gerund replicates 3 times the number which corresponds to # > of rows in the prefix > > #\ ((1,2,3),(5,6,7),:(9,10,11)) > 1 2 3 > > The second gerund appears to yield the concatenation > > The third gerund yields the left > > I don't understand the order these gerunds get applied > > The dictionary say: "If m is a gerund, one of its elements determines > the index argument to the adverb } , and the others modify the > arguments x and y :"[1] > > The phrase that's confusing me is "one of its elements" -- which one? > > [1] http://www.jsoftware.com/help/dictionary/d530n.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
