There are two ways, to produce tacitly what you want: the easy (at least
for me) wicked way and the hard orthodox way. Life is short; so, I will
only show the former. Raul already commented on this method and it
involves cloaking adverbs and conjunctions as monadic and dyadic verbs,
respectively.
NB. Beware of line-wrapping!
(9!:3) 5 2 NB. Box and linear representations...
o=. @:
The adverb (0:`)(,^:) is the key to the black magic kingdom's door. It
takes advantage that the power gerundial form allows the items of its
gerund to represent adverbs and conjunctions. Mind you, this is a wicked
place and takes time and practice to cast the spells. (Save your work!)
Thus,
evoke=. (<'`:') (0:`)(,^:)
cloaks the conjunction whose atomic representation (ar) is (<'`:') (i.e.,
`:) as a dyadic verb, and
train=. evoke&6
becomes a monadic verb corresponding to the adverb `:6,
train <'/'
/
┌─┐
│/│
└─┘
That is right, the verb train just produced an adverb... That is highly
illegal! Yet, now one can, among other things, operate directly on verbs
as if they were nouns. Assume that one wants to produce the verb v1/ , v2/
, v3/ , v4/ from the gerund (v1`v2`v3`v4). Then, one can operate on the
components of the gerund ("0); producing the corresponding verbs (train)
and applying ( (<'/') (0:`)(,^:) ) the adverb whose ar is <'/' (i.e. /) to
them as a verb; boxing them (<) to produce a boxed array of verbs; and
finally inserting the verb append (,) between every verb forming forks
(train o ([ ; (,<,',') ; ])&>/); that is,
train o ([ ; (,<,',') ; ])&>/ o (< o ( (<'/') (0:`)(,^:) ) o train ("0))
v1`v2`v3`v4
v1/ , v2/ , v3/ , v4/
┌──────┬─┬────────────────────────────┐
│┌──┬─┐│,│┌──────┬─┬─────────────────┐│
││v1│/││ ││┌──┬─┐│,│┌──────┬─┬──────┐││
│└──┴─┘│ │││v2│/││ ││┌──┬─┐│,│┌──┬─┐│││
│ │ ││└──┴─┘│ │││v3│/││ ││v4│/││││
│ │ ││ │ ││└──┴─┘│ │└──┴─┘│││
│ │ ││ │ │└──────┴─┴──────┘││
│ │ │└──────┴─┴─────────────────┘│
└──────┴─┴────────────────────────────┘
One can produce a fixed adverb (ag) that produces the verb above using the
ar of the adverb as its argument, to make it reusable,
ag=. (0:`)(,^:) (<@:) (@:(train f.))("0) (train f.@:([ ; (,<,',') ;
])&>/@:)
So,
(<'/') ag v1`v2`v3`v4
v1/ , v2/ , v3/ , v4/
┌──────┬─┬────────────────────────────┐
│┌──┬─┐│,│┌──────┬─┬─────────────────┐│
││v1│/││ ││┌──┬─┐│,│┌──────┬─┬──────┐││
│└──┴─┘│ │││v2│/││ ││┌──┬─┐│,│┌──┬─┐│││
│ │ ││└──┴─┘│ │││v3│/││ ││v4│/││││
│ │ ││ │ ││└──┴─┘│ │└──┴─┘│││
│ │ ││ │ │└──────┴─┴──────┘││
│ │ │└──────┴─┴─────────────────┘│
└──────┴─┴────────────────────────────┘
of course, one can now supply an arbitrary (tacit or explicit) adverb via
its ar,
ar=. 5!:1@<
A=. @:]
(ar'A') ag v1`v2`v3`v4
v1@:] , v2@:] , v3@:] , v4@:]
┌─────────┬─┬─────────────────────────────────────┐
│┌──┬──┬─┐│,│┌─────────┬─┬───────────────────────┐│
││v1│@:│]││ ││┌──┬──┬─┐│,│┌─────────┬─┬─────────┐││
│└──┴──┴─┘│ │││v2│@:│]││ ││┌──┬──┬─┐│,│┌──┬──┬─┐│││
│ │ ││└──┴──┴─┘│ │││v3│@:│]││ ││v4│@:│]││││
│ │ ││ │ ││└──┴──┴─┘│ │└──┴──┴─┘│││
│ │ ││ │ │└─────────┴─┴─────────┘││
│ │ │└─────────┴─┴───────────────────────┘│
└─────────┴─┴─────────────────────────────────────┘
Furthermore, one can cloak the verb (ag) as an adverb (Ag) to hide the
black magic by cloaking ag using a utility adverb (adv),
Ad=. ag adv
v1`v2`v3`v4 (ar'A')Ad
v1@:] , v2@:] , v3@:] , v4@:]
┌─────────┬─┬─────────────────────────────────────┐
│┌──┬──┬─┐│,│┌─────────┬─┬───────────────────────┐│
││v1│@:│]││ ││┌──┬──┬─┐│,│┌─────────┬─┬─────────┐││
│└──┴──┴─┘│ │││v2│@:│]││ ││┌──┬──┬─┐│,│┌──┬──┬─┐│││
│ │ ││└──┴──┴─┘│ │││v3│@:│]││ ││v4│@:│]││││
│ │ ││ │ ││└──┴──┴─┘│ │└──┴──┴─┘│││
│ │ ││ │ │└─────────┴─┴─────────┘││
│ │ │└─────────┴─┴───────────────────────┘│
└─────────┴─┴─────────────────────────────────────┘
(Ad is a Curried (a.k.a. double) adverb that effectively takes two
arguments ((v1`v2`v3`v4) and (ar'A')). If you are interested in adv, you
can search for 'adv=.' in the forum archives (I can also give you a
reference, if necessary).
I hope this is, at least, amusing. ;)
On Wed, Aug 15, 2018 at 1:05 PM, pietdion <[email protected]> wrote:
> Thanks for your answer. But I can't understand it.
> Here is what I want to do.
> I have an adverb called av say.
> Also have verbs say v1, v2, v3.
> Then I want the verb
>
> v=. (v1 av) , (v2 av) , (v3 av)
>
> Of course I can write it out as in the last sentence above, but I was
> hoping to be able just to define a gerund
>
> g=.v1`v2`v3
>
> and then "apply" av to g.
>
>
>
>
>
>
> On Thu, Aug 16, 2018 at 1:35 AM, Raul Miller <[email protected]>
> wrote:
>
> > Generally speaking, its a good idea to include an illustrative use
> > case with a specification, so let's make up one:
> >
> > Let's say my keyboard is getting worn out, and I have to hit the ` key
> > an arbitrary number of times before it works. So I want to be able to
> > form gerunds without using that key.
> >
> > So, let's write a tacit adverb which takes a verb train and flattens
> > it into a gerund.
> >
> > The first step is easy:
> >
> > (a b c d)(`'')
> > +-------------------+
> > |+-+---------------+|
> > ||2|+-+-----------+||
> > || ||a|+-+-------+|||
> > || || ||3|+-+-+-+||||
> > || || || ||b|c|d|||||
> > || || || |+-+-+-+||||
> > || || |+-+-------+|||
> > || |+-+-----------+||
> > |+-+---------------+|
> > +-------------------+
> >
> > And we can build up a tacit verb which performs the needed transform:
> >
> > isT=: 0:`((-:&(,'2')+-:&(,'3'))@((0;0)&{::))@.(1<:L.)
> > t2g=: (}:,t2g@,@{:)@((0;1)&{::)^:isT
> >
> > t2g (a b c d)(`'')
> > +-+-+-+-+
> > |a|b|c|d|
> > +-+-+-+-+
> >
> > But now we get to the tricky part.
> >
> > Conceptually, we want to do something like this:
> >
> > T2G=: (`'')((t2g`)(`:6))
> >
> > But that doesn't actually work. The problem is that we need to
> > transform that initial gerund to a noun representation of a gerund
> > before this can work:
> >
> > T2G=: (`'')G2g((t2g`)(`:6))
> >
> > In other words, we want an adverb G2g which behaves like the verb ('0';<)
> >
> > That's doable, and if you search the forum you can find posts by Jose
> > Mario Quintana which do the needed work (you incorporate that gerund
> > into a verb built with (&[) and then extract the relevant subtree).
> > The modularity of his approach is a little different from what I've
> > described here, but now that you know what you're looking for, that
> > shouldn't stop you...
> >
> > I hope this helps,
> >
> > --
> > Raul
> >
> >
> > On Wed, Aug 15, 2018 at 4:03 AM Piet Google <[email protected]> wrote:
> > >
> > > Maybe already answered elsewhere and/or an ignorant question.
> > > But can’t figure it out.
> > > Is there a (tacit) way to apply an adverb to each of a list of verbs?
> > >
> > > ----------------------------------------------------------------------
> > > 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