You are welcome David,
When the argument verb appears more than once in the produced verb then the
task of producing a tacit adverb is more complicated; for example, it is
not trivial to produce a corresponding tacit adverb for this deceptively
simple template,
mean@:u - u@:mean
In other words, it is not trivial to produce a tacit adverb (gap) such
that, for example,
u gap
mean@:u - u@:mean
(1 + *:)gap
mean@:(1 + *:) - (1 + *:)@:mean
(1 + *:)gap items (i.3 5)
2 2 2
Fortunately, there is a method which can be automated via a tacit adverb
(Adv) such that,
gap=. (mean@:u - u@:mean)Adv
where the parameter u is an unassigned name (or a name already assigned to
a verb) typically representing a verb.
The idea is the following, consider the gerund associated with the template,
(mean@:u - u@:mean)`''
┌───────────────────────────────────┐
│┌─┬───────────────────────────────┐│
││3│┌─────────────┬─┬─────────────┐││
││ ││┌──┬────────┐│-│┌──┬────────┐│││
││ │││@:│┌────┬─┐││ ││@:│┌─┬────┐││││
││ │││ ││mean│u│││ ││ ││u│mean│││││
││ │││ │└────┴─┘││ ││ │└─┴────┘││││
││ ││└──┴────────┘│ │└──┴────────┘│││
││ │└─────────────┴─┴─────────────┘││
│└─┴───────────────────────────────┘│
└───────────────────────────────────┘
and the gerund associated with an instance of the template,
(mean@:(1 + *:) - (1 + *:)@:mean)`''
┌─────────────────────────────────────────────────────────────────┐
│┌─┬─────────────────────────────────────────────────────────────┐│
││3│┌────────────────────────────┬─┬────────────────────────────┐││
││ ││┌──┬───────────────────────┐│-│┌──┬───────────────────────┐│││
││ │││@:│┌────┬────────────────┐││ ││@:│┌────────────────┬────┐││││
││ │││ ││mean│┌─┬────────────┐│││ ││ ││┌─┬────────────┐│mean│││││
││ │││ ││ ││3│┌─────┬─┬──┐││││ ││ │││3│┌─────┬─┬──┐││ │││││
││ │││ ││ ││ ││┌─┬─┐│+│*:│││││ ││ │││ ││┌─┬─┐│+│*:│││ │││││
││ │││ ││ ││ │││0│1││ │ │││││ ││ │││ │││0│1││ │ │││ │││││
││ │││ ││ ││ ││└─┴─┘│ │ │││││ ││ │││ ││└─┴─┘│ │ │││ │││││
││ │││ ││ ││ │└─────┴─┴──┘││││ ││ │││ │└─────┴─┴──┘││ │││││
││ │││ ││ │└─┴────────────┘│││ ││ ││└─┴────────────┘│ │││││
││ │││ │└────┴────────────────┘││ ││ │└────────────────┴────┘││││
││ ││└──┴───────────────────────┘│ │└──┴───────────────────────┘│││
││ │└────────────────────────────┴─┴────────────────────────────┘││
│└─┴─────────────────────────────────────────────────────────────┘│
└─────────────────────────────────────────────────────────────────┘
The latter is just the former where the atomic representation of u has been
replaced by the atomic representation of the instance which suggests a way
to implement the adverb Adv. The details are in the Wicked Toolkit (WT)
script which I have mentioned before in this forum. Actually, the
implementation of Adv is easy using the adverb adv which I also have
mentioned recently.
Needless to say, this is only for those who like to live on the edge. :)
Incidentally, to be able to run the WT script also on the lastest J807-beta
interpreters, one needs to replace < at the front of the line,
Ver=. (<^:(1 -: #)) ...
near the beginning of the script by 0&{::; such that, the line becomes,
Ver=. (0&{::^:(1 -: #)) ...
One can use Adv, of course, to produce a tacit version of RootMe,
RootMe=. ({.~ (_2 2"_ {~ _1 1 1"_ -: [: * u))@:({. , mean , {:)Adv
u RootMe
({.~ (_2 2"_ {~ _1 1 1"_ -: [: * u))@:({. , mean , {:)
v=. 2 + (- ^)
v mean v RootMe ^:_ - 2 1
7.28306e_13
Moreover, the method can be extended further in several ways to produce a
variety of tacit adverbs. The following is a simple example of a double
Curried tacit adverb to provide a favorite fable-while construction,
fw=. ([: action condition 'action^:condition^:_' xi) 2 snb
u v fw
u^:v^:_
On Sun, Sep 16, 2018 at 10:15 AM, David Lambert <[email protected]>
wrote:
> Thanks Jose for guiding me through my first adventure with adverbs
> generating nested trains. Your message helped.
>
> Finally, using only 1 application of evoke gerund:
>
> RootMe =: ((([:`*`)(-:`)((_1 1 1"_)`)({~`)(_2
> 2"_`))({.~`)(`:6))(@:({.,mean,{:))
>
>
> Review:
>
> Goal: find an adverb to replace u in
> ({.~ (_2 2"_ {~ _1 1 1"_ -: [: * u))@:({. , mean , {:)
>
> I had gotten as far as to write the inner train,
> u (([:`*`)(-:`)((_1 1 1"_)`)({~`)(_2 2"_`)(`:6))
> (_2 2"_ {~ _1 1 1"_ -: [: * u)
>
> And then was stuck with two problems.
> 1) failed to recognize that it the inner train is "v" of my hook
> 2) failed to parenthesize @:fork turning it into another adverb
> (@:fork)
>
> RootMe =: ((([:`*`)(-:`)((_1 1 1"_)`)({~`)(_2
> 2"_`)(`:6))({.~`)(`:6))(@:({.,mean,{:))
>
> f =: 2 + (- ^)
>
> f mean f RootMe ^:_ - 2 1
> 7.28306e_13
>
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm