Pascal wrote: > Maybe this answers your question about dyadic use:
It is very helpful. My question was open-ended and you partially answered it; thanks a lot. I posed the question in the first place because Thomas and I have occasionally entertained the possibility of implementing, in a Jx interpreter, a version of }:: (even if it is only done for having a sense of completeness; a http://www.jsoftware.com/forumsearch for }:: returns 44 hits so far). Henry's applyintree conjunction could be a model for it but we do not fully understand it; see also Thomas's comment in the message http://www.jsoftware.com/pipermail/programming/2013-August/033229.html . I guess we will have to wait for Henry or someone else to update NuVoc as he suggested. There another reason to be cautious about the design; apparently }:: was (is?) meant to be an adverb, JVERSION Installer: j602a_win.exe Engine: j701/2011-01-10/11:25 Library: 6.02.023 a0=. }:: type'a0' ┌──────┐ │adverb│ └──────┘ On Fri, Nov 14, 2014 at 8:20 PM, 'Pascal Jasmin' via Programming < [email protected]> wrote: > that is a cool function. Similar to Raul's > > for those who had problems copying it: > > applyintree =: 2 : 0 > if. #n do. ((u applyintree (}.n)) L:_1 ({.n){y) ({.n)} y else. u y end. > : > NB. The rank is s,0 where s is the surplus of x-rank over y-rank. This > causes > NB. the cells of y to be matched up with the largest appropriate blocks > x. This > NB. is necessary because it is impossible to change the shape of the > values being modified > if. #n do. (x u applyintree (}.n) L:_ _1"(0 (,~ >.) x -&(#@$) a) (a =. > ({.n){y)) ({.n)} y > else. x u y end. > ) > > > Maybe this answers your question about dyadic use: > > 1 + applyintree 1 <"0 i.2 3 > ┌─┬─┬─┐ > │0│1│2│ > ├─┼─┼─┤ > │4│5│6│ > └─┴─┴─┘ > > > 1 + (applyintree 1)"1 <"0 i.2 3 > ┌─┬─┬─┐ > │0│2│2│ > ├─┼─┼─┤ > │3│5│5│ > └─┴─┴─┘ > > 1 2 + (applyintree 1)"1 <"0 i.2 3 > ┌─┬───┬─┐ > │0│2 3│2│ > ├─┼───┼─┤ > │3│5 6│5│ > └─┴───┴─┘ > > 1 2 + (applyintree 1)"_1 <"0 i.2 3 > ┌─┬─┬─┐ > │0│2│2│ > ├─┼─┼─┤ > │3│6│5│ > └─┴─┴─┘ > > > 1 2 3 + (applyintree 1) <"0 i.2 3 > ┌─┬─┬─┐ > │0│1│2│ > ├─┼─┼─┤ > │4│6│8│ > └─┴─┴─┘ > > > 1 2&+ (applyintree 1) <"0 i.2 3 > ┌───┬───┬───┐ > │0 │1 │2 │ > ├───┼───┼───┤ > │4 5│5 6│6 7│ > └───┴───┴───┘ > > > > > ----- Original Message ----- > From: Jose Mario Quintana <[email protected]> > To: Programming forum <[email protected]> > Cc: > Sent: Friday, November 14, 2014 6:33 PM > Subject: Re: [Jprogramming] Setting arbitrary leaf of tree > > This subject has been discussed many times in the forum; see, for example, > > http://www.jsoftware.com/pipermail/programming/2013-August/033228.html > > By the way, I am still wondering about the answer to my question in that > message. > > ---------------------------------------------------------------------- > 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
