In the related thread "[Jprogramming] Applying an adverb to a list/gerund
of verbs" (see the trailing post) Pascal wrote:

> Thank you Jose,

You are welcome Pascal (feel free to call me Pepe which is Jose's nickname).


> Would you by any chance have figured out a way to make AR tacit?
> *: AR is so much easier to "call"/type than ar '*:'
> (`'')  almost works, though "fails" with nouns, but is useful for an
argument that can be verb or gerund.

I had not produced a tacit version of AR because, personally, I did not
have the need despite the fact that I use the atomic representation (ar) of
words  (nouns, verbs, adverbs, and conjunctions)  directly from time to
time.  (Why I do not need a tacit AR?  More on that later).  I will mention
some things, which I am sure you know, for the potential benefit of other
members of the forum.  As usual, one could always go the hard orthodox way
(in principle, at least).  However, I like the easy wicked way because I am
naturally lazy.

First a word of caution, the wicked way relies on an apparent internal
design architecture feature of the J interpreters ( which treats J words
the same in a fairly general sense) to perform illegal operations; this
makes possible to produce any kind of adverb in a tacit form, including
verb producing adverbs that refer (tacitly, of course) to the arguments of
the verbs produced.

I have followed the wicked way for several years using different versions
of J interpreters; but, as Martin Nietzel put it recently "We are in twisty
little maze of J versions, all alike."  I have noticed a slight erosion of
the aforementioned feature in the J805 and j06 interpreters.  A more
significant deterioration happened from J807 beta-e to beta-g.  The J804,
J805, J805 and J807 beta-e interpreters just bend and comply while running
the J Wicked Toolkit script [0]; in contrast, the J807 beta-g interpreter
snaps.  Likely, the wicked way will be somewhat compromised in future
official stable versions of the interpreter.  Perhaps, the wicked way will
be banned altogether and no black magic will be allowed.  (It is black
magic in J but it is white magic in many other programming languages that
embrace higher-order functions).

The above notwithstanding, what follows runs fine even on the J807 beta-g
interpreter.

Henceforth I am assuming that the sentences of the post below, up to the
production of AR, have been run: that is,

  (9!:3) 5 2  NB. Box and linear representations...
.
.
.
  AR=: 1 : '5!:1 <''u'''

We can begin with the simple case when the argument of AR is noun,

D=. 5!:0 NB. DoJ: Define. 5!:0 is an adverb and provides a complete inverse
of 5!:1. ( T=. i.2 3 ) 0 1 2 3 4 5 ar'T' ┌─────────┐ │┌─┬─────┐│ ││0│0 1
2││ ││ │3 4 5││ │└─┴─────┘│ └─────────┘ (ar'T') D 0 1 2 3 4 5

A tacit version of AR is,

ART=. an f.adv T ART ┌─────────┐ │┌─┬─────┐│ ││0│0 1 2││ ││ │3 4 5││
│└─┴─────┘│ └─────────┘ (i.2 3) ART ┌─────────┐ │┌─┬─────┐│ ││0│0 1 2││ ││
│3 4 5││ │└─┴─────┘│ └─────────┘ (i.2 3) ART D 0 1 2 3 4 5

Of course, if the argument of ART is a verb then we will need something
more elaborated...  Actually, that is not necessarily the case!  For
instance,

+/@:*: ART

┌──────────┐

│┌─┬──────┐│

││0│+/@:*:││

│└─┴──────┘│

└──────────┘


is an illegal noun; yet, as far as the interpreter is concerned, it is an
ar of +/@:*:


   +/@:*: ART D
+/@:*:
┌─────┬──┬──┐
│┌─┬─┐│@:│*:│
││+│/││  │  │
│└─┴─┘│  │  │
└─────┴──┴──┘

and it can be used, as a whole, in place of the actual ar (not tested it
much with the beta interpreters); for example,


(+/@:*: ART`:6) 1 2 3 14

There are instances where one might require the real thing for internal
inspection and modification of a verb structure (for example, to replace
the all its components of the form [: u v by (u@:v)).


In that case, the following version should work,

   tie=.   (<'`') (0:`)(,^:)

   ART=. (an`('' $ '' tie~ ]))@.(2097152 = 3!:0) adv

(use 262144 instead of 2097152 for earlier versions of the interpreter if
necessary); for  example,

   (i.2 3) ART
┌─────────┐
│┌─┬─────┐│
││0│0 1 2││
││ │3 4 5││
│└─┴─────┘│
└─────────┘

   u@:v AR
┌──────────┐
│┌──┬─────┐│
││@:│┌─┬─┐││
││  ││u│v│││
││  │└─┴─┘││
│└──┴─────┘│
└──────────┘

   u@:v ART D
u@:v
┌─┬──┬─┐
│u│@:│v│
└─┴──┴─┘

   (toCRLF f.ART) -: (toCRLF f.AR)
1

By the way, the gerundial representation produced by (`'') technically is
not an ar; for example,

   u@:v (`'') D
|rank error: D
|   u@:v(`'')    D

PS.  I had not produced ART before because I have access to a custom
foreign which allows to use verbs that require named words (e.g. (4!:0),
(5!:1), (5!:2), etc.) namelessly.

Reference

[0] J Wicked Toolkit
    http://www.2bestsystems.com/foundation/j/Jx.zip
    \Jx\J\J Wicked Toolkit.ijs





On Thu, Aug 16, 2018 at 11:21 PM, 'Pascal Jasmin' via Programming <
[email protected]> wrote:

>  Thank you Jose,
> Would you by any chance have figured out a way to make AR tacit?
> *: AR is so much easier to "call"/type than ar '*:'
> (`'')  almost works, though "fails" with nouns, but is useful for an
> argument that can be verb or gerund.
>     On Thursday, August 16, 2018, 7:48:47 p.m. EDT, Jose Mario Quintana <
> [email protected]> wrote:
>
>  One the one hand, I find your adverb neat and clever.  On the other hand,
> I
> like them beautiful and powerful.  ;)
>
> Powerful?
>
>   (9!:3) 5 2  NB. Box and linear representations...
>
>
>   o=. @:
>   c=. "_
>
>   ar=. 5!:1@:<
>   an=.  <@:((,'0') ,&:< ])f.  NB. Atomizing (monadic verb)
>
>   d=. (a0=. `'') (a1=. (@:[) ((<'&')`) (`:6)) (a2=. (`(<(":0);_)) (`:6))
>   av=. ((ar'a0')`)  (`(ar'a1')) (`(ar'a2') ) (`:6)
>     NB. Adverbing a monadic verb (adv)
>     assert 1 4 9 -: 1 2 3 *: av
>
>   train=. (<'`:') (0:`)(,^:)&6
>   fix=.  (<'f.') (0:`)(,^:)
>
>   af=. an o fix f. NB. Atomizing after fixing a word (monadic verb)
>   aw=. < o ((0;1;0)&{::)  NB. Fetching the atomic representation (monadic
> verb)
>   a3=. (o (train o aw f.)) ('av'f.)
>     NB. train o aw  gets the (noun or verb) argument
>
>   adv=. train o ((af'c') ; ] ; (af'a3')c) f.av
>
> The motivation for producing the tacit adverb adv was to reduce directly
> the production of tacit adverbs to the production of tacit verbs,
>
>   ag=. (0:`)(,^:) (<@:) (@:(train f.))("0) (train f.@:([ ; (,<,',') ;
> ])&>/@:)
>
>   A=. @:]
>
>   Ad=. ag adv
>
>   v1`v2`v3`v4 (ar'A')Ad
> v1@:] , v2@:] , v3@:] , v4@:]
> ┌─────────┬─┬─────────────────────────────────────┐
> │┌──┬──┬─┐│,│┌─────────┬─┬───────────────────────┐│
> ││v1│@:│]││ ││┌──┬──┬─┐│,│┌─────────┬─┬─────────┐││
> │└──┴──┴─┘│ │││v2│@:│]││ ││┌──┬──┬─┐│,│┌──┬──┬─┐│││
> │        │ ││└──┴──┴─┘│ │││v3│@:│]││ ││v4│@:│]││││
> │        │ ││        │ ││└──┴──┴─┘│ │└──┴──┴─┘│││
> │        │ ││        │ │└─────────┴─┴─────────┘││
> │        │ │└─────────┴─┴───────────────────────┘│
> └─────────┴─┴─────────────────────────────────────┘
>
>   AR=: 1 : '5!:1 <''u'''
>   advE =: 1 : 'AR(u`)(`:6)'
>
>   AdE=. ag advE
>
>   v1`v2`v3`v4 (ar'A')AdE
> v1@:] , v2@:] , v3@:] , v4@:]
> ┌─────────┬─┬─────────────────────────────────────┐
> │┌──┬──┬─┐│,│┌─────────┬─┬───────────────────────┐│
> ││v1│@:│]││ ││┌──┬──┬─┐│,│┌─────────┬─┬─────────┐││
> │└──┴──┴─┘│ │││v2│@:│]││ ││┌──┬──┬─┐│,│┌──┬──┬─┐│││
> │        │ ││└──┴──┴─┘│ │││v3│@:│]││ ││v4│@:│]││││
> │        │ ││        │ ││└──┴──┴─┘│ │└──┴──┴─┘│││
> │        │ ││        │ │└─────────┴─┴─────────┘││
> │        │ │└─────────┴─┴───────────────────────┘│
> └─────────┴─┴─────────────────────────────────────┘
>
> (By the way, you might appreciate that both adv and advE, in this context,
> are acting as triple (Curried) adverbs.)
>
> The end result is the same; however, one important difference is that
> (ar'A')Ad is tacit but (ar'A')Ad is not (because AR is not tacit).  Recall,
> Piet Google was asking for "a (tacit) way to apply an adverb to each of a
> list of verbs."
>
> Furthermore, adv has the implicit tacit power (provided by (0:`)(,^:)) to
> perform forbidden tricks that advE cannot; adv actually applies its
> argument verb to the argument of the resulting adverb even if that argument
> happens to be a verb; for example,
>
>   *: <adv
> ┌──┐
> │*:│
> └──┘
>
> boxes *:,
>
>   > *: <adv 1 2 3
> 1 4 9
>
> In contrast,
>
>   *: <advE
> < *:
> ┌─┬──┐
> │<│*:│
> └─┴──┘
>   > *: <advE 1 2 3
> 0 1 1
>
>
> On Thu, Aug 16, 2018 at 3:11 PM, 'Pascal Jasmin' via Programming <
> [email protected]> wrote:
>
> >  A simpler version of your usual adv definition, that seems pretty clean
> > (without my usual processing)
> >
> > AR=: 1 : '5!:1 <''u'''
> > adv =: 1 : 'AR(u`)(`:6)'
> >
> >
> >  1 2 3 *: adv
> >
> > 1 4 9
> >
> > not sure if this works with all your utilities.
>
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to