Viktor, your result does not match Raul's and only the first verb in fns seems to be being executed:
fns eachdyad (-~ +/)"1&.>/"_1@:(<@[ ,. ]) Am I missing something? ________________________________ From: Viktor Cerovski <[email protected]> To: [email protected] Sent: Thursday, August 20, 2009 8:36:40 AM Subject: Re: [Jprogramming] Applying gerund Raul Miller-4 wrote: > > On Wed, Aug 19, 2009 at 11:28 PM, Sherlock, > Ric<[email protected]> wrote: >> fns=: ((-~ +/)"1)`((*~ +/)"1)`((+~ +/)"1)`((%~ +/)"1) >> rnge=. >: i. 5 >> ]data=. (i.5 3);(i.5 2);(i.5 4);(i.5 3) > ... >> Given the gerund "fns" (4 dyadic verbs) and the noun "data" (4 arrays >> which are the desired arguments for the corresponding verbs in the >> gerund), how can I apply the verbs to their respective arguments >> such that: >> >> rnge applyVerbs data >> +-------------------+--------------+--------------+--------------+ >> | 3 1.5 1 0.75 0.6| 7 8 9 10 11| 1 2 3 4 5| 2 1 0 _1 _2| >> |12 6 4 3 2.4|23 24 25 26 27| 5 10 15 20 25|11 10 9 8 7| >> |21 10.5 7 5.25 4.2|39 40 41 42 43| 9 18 27 36 45|20 19 18 17 16| >> |30 15 10 7.5 6|55 56 57 58 59|13 26 39 52 65|29 28 27 26 25| >> |39 19.5 13 9.75 7.8|71 72 73 74 75|17 34 51 68 85|38 37 36 35 34| >> +-------------------+--------------+--------------+--------------+ > > |.fns 4 :'[email protected]&.>/y'"_1 (<rnge),. data > +-------------------+--------------+--------------+--------------+ > | 3 1.5 1 0.75 0.6| 7 8 9 10 11| 1 2 3 4 5| 2 1 0 _1 _2| > |12 6 4 3 2.4|23 24 25 26 27| 5 10 15 20 25|11 10 9 8 7| > |21 10.5 7 5.25 4.2|39 40 41 42 43| 9 18 27 36 45|20 19 18 17 16| > |30 15 10 7.5 6|55 56 57 58 59|13 26 39 52 65|29 28 27 26 25| > |39 19.5 13 9.75 7.8|71 72 73 74 75|17 34 51 68 85|38 37 36 35 34| > Nice line Raul. The tacit adverb eachd based on your code is: eachd=:@.0(&.>)/("_1)(@:(<@[,.])) (<rnge) fns eachd data +--------------+--------------+--------------+--------------+ | 2 1 0 _1 _2| 0 _1 _2 _3 _4| 5 4 3 2 1| 2 1 0 _1 _2| |11 10 9 8 7| 4 3 2 1 0|21 20 19 18 17|11 10 9 8 7| |20 19 18 17 16| 8 7 6 5 4|37 36 35 34 33|20 19 18 17 16| |29 28 27 26 25|12 11 10 9 8|53 52 51 50 49|29 28 27 26 25| |38 37 36 35 34|16 15 14 13 12|69 68 67 66 65|38 37 36 35 34| +--------------+--------------+--------------+--------------+ If it is important that the left argument of the verb stay unboxed, the following tacit adverb eachdyad should be helpful: eachdyad=:@.0(&.>)/("_1)(@:(<@[,.])) rnge fns eachdyad data +--------------+--------------+--------------+--------------+ | 2 1 0 _1 _2| 0 _1 _2 _3 _4| 5 4 3 2 1| 2 1 0 _1 _2| |11 10 9 8 7| 4 3 2 1 0|21 20 19 18 17|11 10 9 8 7| |20 19 18 17 16| 8 7 6 5 4|37 36 35 34 33|20 19 18 17 16| |29 28 27 26 25|12 11 10 9 8|53 52 51 50 49|29 28 27 26 25| |38 37 36 35 34|16 15 14 13 12|69 68 67 66 65|38 37 36 35 34| +--------------+--------------+--------------+--------------+ -- View this message in context: http://www.nabble.com/Applying-gerund-tp25055557s24193p25061195.html Sent from the J Programming mailing list archive at Nabble.com. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
