fn =: <@|.@[ (|.each@:|.@:($~ each 1 >. <:) 4 : 'x/ y' every <\.@]) ]
%`- fn 1 2 3 4 5 6 7 0.6 1.66667 0.333333 9 _5 _1 7 *`+ fn 1 2 3 4 5 6 7 209 209 207 69 65 13 7 ----- Original Message ----- From: Skip Cave <[email protected]> To: "[email protected]" <[email protected]> Sent: Tuesday, February 23, 2016 10:36 PM Subject: Re: [Jprogramming] Am I understanding m/y ? Brian, Pascal, Nice! Can you design a function that mimics scan, using a gerund? What would the definition of "fn" be? *`+ fn 1 2 3 4 5 6 7 209 209 207 69 65 13 7 %`- fn 1 2 3 4 5 6 7 0.6 1.66667 0.33333 9 _5 _1 7 Step-by-step: 1%2-3%4-5%6-7 0.6 2-3%4-5%6-7 1.66667 3%4-5%6-7 0.33333 4-5%6-7 9 5%6-7 _5 6-7 _1 7 7 Skip Cave Cave Consulting LLC On Tue, Feb 23, 2016 at 6:27 PM, Pascal Jasmin <[email protected]> wrote: > nice... maybe small cleanup, > > ".@; every ([,(<'+'),])`([,(<'*'),])/&.|.each ": each each<\. 1 2 3 4 5 6 7 > > There is this way too, > > (< +`*) (|.each@:|.@:($~ each 1 >. <:) 4 : 'x/ y' every <\.@]) 1 2 3 4 5 6 7 > 209 209 207 69 65 13 7 > > > > ----- Original Message ----- > From: Brian Schott <[email protected]> > To: Programming forum <[email protected]> > Sent: Tuesday, February 23, 2016 5:44 PM > Subject: Re: [Jprogramming] Am I understanding m/y ? > > Simple? I'm sure this is not what you meant, but ... > > ".@;@|."1 &>([,(<'+'),])`([,(<'*'),])/&|.&.> <@":"0 each<\. 1 2 3 4 5 > 6 7 > 209 209 207 69 65 13 7 > > > On Tue, Feb 23, 2016 at 3:38 PM, Skip Cave <[email protected]> wrote: > >> Here's what we get today: >> >> *`+/\. 1 2 3 4 5 6 7 >> 209 382 207 188 65 42 7 >> >> Step-by-step: >> >> 1*2+3*4+5*6+7 >> 209 >> 2*3+4*5+6*7 >> 382 >> 3*4+5*6+7 >> 207 >> 4*5+6*7 >> 188 >> 5*6+7 >> 65 >> 6*7 >> 42 >> 7 >> 7 >> >> >> What Raul would like (I think): >> >> *`+/\. 1 2 3 4 5 6 7 >> 209 209 207 69 65 13 7 >> >> Step-by-step: >> >> 1*2+3*4+5*6+7 >> 209 >> 2+3*4+5*6+7 >> 209 >> 3*4+5*6+7 >> 207 >> 4+5*6+7 >> 69 >> 5*6+7 >> 65 >> 6+7 >> 13 >> 7 >> 7 >> >> So the question is: Is there a simple way to achieve this second process? >> >> Skip >> >> Skip Cave >> Cave Consulting LLC >> ---------------------------------------------------------------------- >> 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
