only the dyadic/dyadic form has any material running time overhead to it.
----- Original Message ----- From: Jose Mario Quintana <[email protected]> To: Programming forum <[email protected]> Sent: Wednesday, April 20, 2016 6:09 PM Subject: Re: [Jprogramming] Adverbial Tacit Jym -spoilered Pascal wrote: "The weirdness of this trick though is that the resulting verb only has one meaningful valence (which most/great many verbs already do)." A summary of the different combinations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ┌───────┬───────┬───────────────┬──────────────────────────┐ │u │u a │u form │(u a) form ( ... ) │ ├───────┼───────┼───────────────┼──────────────────────────┤ │dyadic │monadic│$: │ (( ... ) : )│ ├───────┼───────┼───────────────┼──────────────────────────┤ │monadic│dyadic │$: │ ( : ( ... ))│ ├───────┼───────┼───────────────┼──────────────────────────┤ │monadic│monadic│$:~ │(@:]) (( ... ) : )│ ├───────┼───────┼───────────────┼──────────────────────────┤ │dyadic │dyadic │$:(q=. @:(,&<))│((&>)/)( : ( ... ))│ └───────┴───────┴───────────────┴──────────────────────────┘ On Wed, Apr 20, 2016 at 5:20 PM, 'Pascal Jasmin' via Programming < [email protected]> wrote: > a1x1x0x1=. : (($: @: +) % ($: @: *)) > NB. (u @: +) % (u @: *) > > %: a1x1x0x1 > %: :($:@:+ % $:@:*) > > > 4 %: :($:@:+ % $:@:*) 4 > 0.707107 > > > the alternative: > > 4 %: 1 : 'u@:+ % u@:*' 4 > > is not that much simpler. One pretty cool use of the technique is to > return a tacit adverb from explicit... what I call double adverbs. Say for > example the middle % was another parameter, > > +: % 1 : ': (($: @: +) u ($: @: *))' > +: :($:@:+ % $:@:*) > > > 4 %: % 1 : ': (($: @: +) u ($: @: *))' 4 > 0.707107 > > and this can also be done with a conjunction to say make the left + > another parameter > > 4 %: % 2 : ': (($: @: v) u ($: @: *))' + 4 > 0.707107 > > The weirdness of this trick though is that the resulting verb only has one > meaningful valence (which most/great many verbs already do) > > +: : (+ 2 : '($: u v)' -: ) 5 > 10 > > weirder for dyadic fork > > * (&>)/ ( : (+ 2 : '($:@:(,&<) u v)' - ) ) > *&>/ :($:@:(,&<) + -) > > 2 * (&>)/ ( : (+ 2 : '($:@:(,&<) u v)' - ) ) 4 NB. 8 + _2 > 6 > > > ----- Original Message ----- > From: Jose Mario Quintana <[email protected]> > To: Programming forum <[email protected]> > Sent: Tuesday, April 19, 2016 7:15 PM > Subject: Re: [Jprogramming] Adverbial Tacit Jym > > Hints and solutions for exercise 1.1.0.1 and 1.1.0.3 are shown after the > alerts. These complete the whole Exercise 1.1.0 because solutions for the > item 1.1.0.2 have been shown already (see the last trailing message > bellow). The solutions shown bellow for 1.1.0.1 and 1.1.0.3 and one > solution for 1.1.0.2 involve multiple instances of the argument u; thus, > there are solutions for the 1.1.0.1 item as well. > > Let us make the exercises concrete first by providing specific examples; > what is left is to provide the adverbs: > > - 1.1.0.1 Provide the adverb a1x1x0x1 corresponding to the dyadic form (u > @: +) % (u @: *) using a variation of the trick shown in the definition > of a1x1 ( see > http://www.jsoftware.com/pipermail/programming/2016-April/044935.html ). > For example, > > 1 2 %: a1x1x0x1 3 4 > 1.15470054 0.866025404 > > - 1.1.0.3 Provide the adverb a1x1x0x3 corresponding to the dyadic form > (u @: +) % (u @: *) using, again, a variation of the trick shown in the > definition of a1x1 . For example, > > 2 3 %:a1x1x0x3 4 5 > 0.577350269 0.306199553 > > > H i n t s f i r s t . . . > H i n t s f i r s t . . > H i n t s f i r s t . > H i n t s f i r s t > H i n t s f i r s > H i n t s f i r > H i n t s f i > H i n t s f > H i n t s > H i n t s > H i n t > H i n > H i > H > > - 1.1.0.1 The adverb a1x1x0x1 is a counterpart of a1x1 swapping monadic > and dyadic. > > - 1.1.0.3 Given the adverbs p=. (&>)/ and q=. @:(,&<) then one can > assert X ((u p)q -: u) Y . For example, > > 1 2 ( (% p)q -: %) 3 4 > 1 > > > S o l u t i o n s a r e n e x t . . . > S o l u t i o n s a r e n e x t . . > S o l u t i o n s a r e n e x t . > S o l u t i o n s a r e n e x t > S o l u t i o n s a r e n e x > S o l u t i o n s a r e n e > S o l u t i o n s a r e n > S o l u t i o n s a r e > S o l u t i o n s a r e > S o l u t i o n s a r > S o l u t i o n s a > S o l u t i o n s > S o l u t i o n s > S o l u t i o n > S o l u t i o > S o l u t i > S o l u t > S o l u > S o l > S o > S > > - 1.1.0.1 > > a1x1x0x1=. : (($: @: +) % ($: @: *)) > NB. (u @: +) % (u @: *) > > %: a1x1x0x1 > %: :($:@:+ % $:@:*) > > 1 2 %: a1x1x0x1 3 4 > 1.15470054 0.866025404 > > > - 1.1.0.3 > > a1x1x0x3=. ((&>)/) ( : (*:@:(1 -~ $:q) % %:@:(1 + $:q))) > NB. *:@:(1 -~ u ) % %:@:(1 + u ) > > %:a1x1x0x3 > %:&>/ :(*:@:(1 -~ $:@:(,&<)) % %:@:(1 + $:@:(,&<))) > > 2 3 %:a1x1x0x3 4 5 > 0.577350269 0.306199553 > > > > > > On Wed, Apr 13, 2016 at 7:33 PM, Jose Mario Quintana < > [email protected]> wrote: > > > Pascal, you are right about the example. Allow me to be more specific by > > labeling the cases: > > > > Exercise 1.1.0 > > > > - 1.1.0.0 Provide an example of the method when there are multiple > > instances of u > > > > - 1.1.0.1 Provide an example of the method when u is monadic and the > > product (u a) is dyadic > > > > - 1.1.0.2 Provide an example of the method when u is monadic and the > > product is also monadic > > > > - 1.1.0.3 Provide an example of the method when u is dyadic and the > > product is dyadic > > > > The generic form u@{. + u@{: corresponds to the case 1.1.0.2 when > > there are two instances of u. The challenge is to exhibit an adverb, > say, > > a1x1x0x2 such that, for example, > > > > *: a1x1x0x2 3 4 5 6 > > 45 > > > > by means of the method (i.e., using the same kind of trick). > > > > > > A m i n o r h i n t f o l l o w s . . . > > A m i n o r h i n t f o l l o w s . . > > A m i n o r h i n t f o l l o w s . > > A m i n o r h i n t f o l l o w s > > A m i n o r h i n t f o l l o w > > A m i n o r h i n t f o l l o > > A m i n o r h i n t f o l l > > A m i n o r h i n t f o l > > A m i n o r h i n t f o > > A m i n o r h i n t f > > A m i n o r h i n t > > A m i n o r h i n t > > A m i n o r h i n > > A m i n o r h i > > A m i n o r h > > A m i n o r > > A m i n o r > > A m i n o > > A m i n > > A m i > > A m > > A > > A > > > > > > #(5!:5)<'a1x1x0x1' NB. The tally of the lr of one solution... > > 28 > > > > Incidentally, when u is a large verb and there are multiple instances > of > > it, this kind of solutions produce thrifty verbs. The caveat, because > > their reliance on $:, is that cannot be embedded in within a fixed tacit > > verb... Unless, they are wearing a suit of armor! > > > > > > On Tue, Apr 12, 2016 at 2:32 PM, 'Pascal Jasmin' via Programming < > > [email protected]> wrote: > > > >> > >> > >> > Provide an example of the method when there are multiple instances of > u > >> > >> Not sure how here, except where 1 : 'u@{. + u@{:' could be refactored > >> into a single u, and then use $: > >> > >> Very interested in understanding other 3 examples. > >> > >> > >> ----- Original Message ----- > >> From: Jose Mario Quintana <[email protected]> > >> To: Programming forum <[email protected]> > >> Sent: Tuesday, April 12, 2016 10:17 AM > >> Subject: Re: [Jprogramming] Adverbial Tacit Jym > >> > >> Anyone that wants to know the answer can find the original one [0] > written > >> almost 10 years ago! > >> > >> Sorry Dan, here there are more minor hints ;) > >> > >> The importance of this solution is that illustrates a fairly general and > >> straightforward method for writing of a very common form: u a where u > is a > >> verb and its product (u a) is also a verb. > >> > >> This a bonus exercise: > >> > >> Exercise 1.1.0 > >> > >> - Provide an example of the method when there are multiple instances > of u > >> > >> - Provide an example of the method when u is monadic and the product > (u > >> a) is dyadic > >> > >> - Provide an example of the method when u is monadic and the product is > >> also monadic > >> > >> - Provide an example of the method when u is dyadic and the product is > >> dyadic > >> > >> > >> > >> [0] [Jprogramming] Tacit adverb definitions? > >> http://www.jsoftware.com/pipermail/programming/2006-July/002627.html > >> > >> On Tue, Apr 12, 2016 at 8:50 AM, Dan Bron <[email protected]> wrote: > >> > >> > Pascal wrote: > >> > > for clarity, the answer is, > >> > > >> > No hints, please! Anyone who wants to know the answer can just scroll > >> down > >> > in Raul’s original message. > >> > > >> > -Dan > >> > ---------------------------------------------------------------------- > >> > 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 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
