In a scan I have to deal with both kinds of $y. -- Raul
On Tue, Feb 23, 2016 at 5:12 AM, Linda A Alvord <[email protected]> wrote: > Shouldn't your choice of *`+ or +`* depend on the choice of when $y is odd or > even? > > Linda > > > -----Original Message----- > From: Programming [mailto:[email protected]] On Behalf > Of Raul Miller > Sent: Tuesday, February 23, 2016 4:42 AM > To: Programming forum > Subject: Re: [Jprogramming] Am I understanding m/y ? > > Skip asks: "What am I missing?" > > In a scan, we are not performing a single reduction but a sequence of > reductions. > > Examples: > > *`+/\ 1 2 3 4 5 6 7 > 1 2 5 14 29 104 209 > *`+/\. 1 2 3 4 5 6 7 > 209 382 207 188 65 42 7 > > These can be refactored so that you can extract the sequences: > > *`+/@> <\ 1 2 3 4 5 6 7 > 1 2 5 14 29 104 209 > *`+/@> <\. 1 2 3 4 5 6 7 > 209 382 207 188 65 42 7 > > So, for example, using a suffix scan: > > *`+/ 1 2 3 4 5 6 7 > 209 > *`+/ 2 3 4 5 6 7 > 382 > > These are equivalent to > 1*2+3*4+5*6+7 > 209 > 2*3+4*5+6*7 > 382 > > And there seems to be no way to express an m/y scan such that 6 and 7 are > always added while 5 and 6+7 are always multiplied (for the cases where these > numbers are present). > > Or, if you prefer, swap out + and * with some other operations... > > Thanks, > > -- > Raul > > > On Tue, Feb 23, 2016 at 1:38 AM, Skip Cave <[email protected]> wrote: >> I think I'm missing something... >> >> Raul said: "Do we have no way of performing the insertion in the same >> order as the evaluation order? This would be important in constructing >> efficient gerund scans." >> >> There are only two ways to alternatively insert operators in a >> sequence of numbers: >> >> 1*2+3*4+5*6+7 >> 209 >> 1+2*3+4*5+6*7 >> 383 >> >> The gerund insert allows inserting the verbs either way: >> >> *`+/ 1 2 3 4 5 6 7 >> 209 >> +`*/ 1 2 3 4 5 6 7 >> 383 >> >> Reversing the order of the gerund has the identical effect as >> right-to-left insertion: >> The order that you insert the verbs in the vector shouldn't matter, >> since the execution occurs after all insertions. >> >> What am I missing? >> >> Skip >> >> Skip Cave >> Cave Consulting LLC >> >> >> On Mon, Feb 22, 2016 at 11:38 PM, Raul Miller <[email protected]> wrote: >>> Ok, so we left to right insertion combined with right to left >>> evaluation. That might be "algorithmically interesting" but it also >>> seems unnecessarily complex for some useful cases. >>> >>> Do we have no way of performing the insertion in the same order as the >>> evaluation order? This would be important in constructing efficient >>> gerund scans. >>> >>> And, currently, I'm not seeing any such option - given left to right >>> insertion, we would need left to right evaluation of the insertion for >>> an efficient scan. >>> >>> Argh... >>> >>> -- >>> Raul >>> >>> >>> On Mon, Feb 22, 2016 at 11:54 PM, bill lam <[email protected]> wrote: >>>> In DOJ, but inside Introduction part >>>> >>>> http://www.jsoftware.com/help/dictionary/intro21.htm >>>> >>>> to recap, >>>> x=.4 >>>> >>>> +`*/1,x,3,x,3,x,1 >>>> 125 >>>> 1 + x * 3 + x * 3 + x * 1 >>>> 125 >>>> 1 * x + 3 * x + 3 * x + 1 >>>> 61 >>>> >>>> >>>> Пн, 22 фев 2016, Raul Miller написал(а): >>>>> http://www.jsoftware.com/help/dictionary/d420.htm says: >>>>> >>>>> m/y inserts successive verbs from the gerund m between items of y, >>>>> extending m cyclically as required. Thus, +`*/i.6 is 0+1*2+3*4+5 >>>>> >>>>> But it does not include an example of m/y where y contains an odd >>>>> number of elements. >>>>> >>>>> From the description, I would expect +`*/3 4 5 to give the result 3*4+5 >>>>> >>>>> However: >>>>> 3*4+5 >>>>> 27 >>>>> +`*/3 4 5 >>>>> 23 >>>>> >>>>> I'm thinking that this might be a bug in the interpreter. >>>>> >>>>> Is there some application, though, that requires the current behavior? >>>>> >>>>> Thanks, >>>>> >>>>> -- >>>>> Raul >>>>> ---------------------------------------------------------------------- >>>>> For information about J forums see http://www.jsoftware.com/forums.htm >>>> >>>> -- >>>> regards, >>>> ==================================================== >>>> GPG key 1024D/4434BAB3 2008-08-24 >>>> gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3 >>>> gpg --keyserver subkeys.pgp.net --armor --export 4434BAB3 >>>> ---------------------------------------------------------------------- >>>> 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 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
