Thinking about this further - I am not sure that a3 (and, thus a6)
work quite like I had previously suggested. Or, maybe they do, but...

Ok, let's start over:

Hypothetically speaking, av is almost our adverb that transforms a
gerund manipulating verb into an adverb which performs that
transformation on a verb:

   1: [^:('0:'-:])L:0&(>:@0:a0) hg
┌───────────┐
│┌─┬───────┐│
││@│┌──┬──┐││
││ ││>:│1:│││
││ │└──┴──┘││
│└─┴───────┘│
└───────────┘
>:@1:

Here, I've created a simple verb >:@0: and extracted its gerund
representation using a0. And, I've bound that gerund as the right
argument to an expression ([^:('0:'-:])L:0) which will replace the
'0:' node with its other argument. So as you can see above, that works
just fine with hg. But it also works with av(`:6) as you can see here:

   1: [^:('0:'-:])L:0&(>:@0:a0) av(`:6)
┌───────────┐
│┌─┬───────┐│
││@│┌──┬──┐││
││ ││>:│1:│││
││ │└──┴──┘││
│└─┴───────┘│
└───────────┘
>:@1:

The problem is that things happen in the wrong order if we try to
encapsulate that av(`:6) as a single step:

   1: [^:('0:'-:])L:0&(>:@0:a0) (av(`:6))
|syntax error
|   1:[^:('0:'-:])L:0&(>:@0:a0)    (av(`:6))

So a6 is all about procrastinating the application of a final `:6
until after the adverb derived by av has had a chance to do its thing.

And, we're using the relaxed rules on `:6 trains to do that procrastinating.

But `:6 trains are just fine using gerunds in place of verbs. And ar
extracts the gerund representation. So... my earlier claim that a3 was
working on live verbs? That might have been false, because I didn't
think about how a3 was being used. (I am still figuring all this out
for myself.)

Actually, it probably *was* false. But I have not proven to myself yet
that it is false.

I still have not completely internalized all of how this is working -
I'm still in the hypothesis/test phase of digesting things and that
winds up with me being mostly wrong and gradually learning from my
mistakes (and, also, it leaves my learning somewhat at the mercy of my
ability to come up with plausible-even-if-wrong ideas and then come up
with some way to test them for accuracy...).

So... anyways... I hope this helps someone, despite my potential inaccuracies...

Thanks,

-- 
Raul

On Sat, Oct 21, 2017 at 4:43 PM, Erling Hellenäs
<[email protected]> wrote:
> Hi all !
>
> I do my best to understand this. Like Raul I name things. I created some
> explanations. However, I didn't manage to understand how a3 and a6 works.
> Maybe someone can help?
>
> My project:
>
> 9!:14''
>
> o=: @:
>
> ar=: 5!:1 @:<
>
> ar 'o'
>
> emptyGerund=: `''
>
> emptyGerund
>
> DoOnLeftArgAdverb=: (@:[) ((<'&')`) (`:6)
>
> +/ DoOnLeftArgAdverb
>
> InfinityAdverb=: (`(<(":0);_)) (`:6)
>
> %InfinityAdverb
>
> ExecuteDoOnLeftArgAdverbWithLeftArg=: ((ar'emptyGerund')`)
> (`(ar'DoOnLeftArgAdverb')) (`(ar'InfinityAdverb') ) (`:6)
>
> 1 2 3 *: ExecuteDoOnLeftArgAdverbWithLeftArg
>
> FetchAtomicRepr=: < o ((0;1;0)&{::) NB. Fetching the atomic representation
>
> br=: 5!:2@:<
>
> f=: -@:-@-
>
> br 'f'
>
> FetchAtomicRepr br 'f'
>
> a3=: (@: (FetchAtomicRepr f.)) ('ExecuteDoOnLeftArgAdverbWithLeftArg' f.)
>
> RankInfinity=: "_
>
> +RankInfinity
>
> EvokeGerundTrain=: `:6
>
> (+/)`%`# EvokeGerundTrain 1 2 3
>
> a6=: ((( ar'RankInfinity') ; ] ; ( ar'a3')"_)
> ('ExecuteDoOnLeftArgAdverbWithLeftArg'f.)) (`:6)
>
> hg=: `((ar'a6')`(ar'EvokeGerundTrain')) (`:6)
>
> 1 2 3 ((<'*:') ; ]) hg
>
> an=: <@:((,'0') (,&<) ]) NB. Atomizing words (monadic verb)
>
> an +`-`*`%
>
> AdverbToPackvuGerundWithAt=:< o ((('@:') ; < o |.)) o (('';1)&{::) hg
>
> (-`<) AdverbToPackvuGerundWithAt
>
> 3 (-`<) AdverbToPackvuGerundWithAt 2
>
> AdverbToPackReverseOrderGerundWithAt=: ([ , (<'@:') , ])/o |. o
> (('';1)&{::)hg
>
> *:`-`%`+: AdverbToPackReverseOrderGerundWithAt
>
> *:`-`%`+: AdverbToPackReverseOrderGerundWithAt 5
>
> ConjunctionToExecuteVWithArgumentU=: ((an f.hg) (` (|. o ((('';1)&{::))hg))
> (an f.hg))
>
> 1 2 3 ConjunctionToExecuteVWithArgumentU (+/)
>
>
> The printout:
>
>
>    9!:14''
> j806/j64/windows/beta/BEST/Jx-patches/2017-10-06T14:44:47
>    o=: @:
>    ar=: 5!:1 @:<
>    ar 'o'
> ┌──┐
> │@:│
> └──┘
>    emptyGerund=: `''
>    emptyGerund
> `''
>    DoOnLeftArgAdverb=: (@:[) ((<'&')`) (`:6)
>    +/ DoOnLeftArgAdverb
> &(+/@:[)
>    InfinityAdverb=: (`(<(":0);_)) (`:6)
>    %InfinityAdverb
> 0
>    ExecuteDoOnLeftArgAdverbWithLeftArg=: ((ar'emptyGerund')`)
> (`(ar'DoOnLeftArgAdverb')) (`(ar'InfinityAdverb') ) (`:6)
>    1 2 3 *: ExecuteDoOnLeftArgAdverbWithLeftArg
> 1 4 9
>    FetchAtomicRepr=: < o ((0;1;0)&{::)  NB. Fetching the atomic
> representation
>    br=: 5!:2@:<
>    f=: -@:-@-
>    br 'f'
> ┌────────┬─┬─┐
> │┌─┬──┬─┐│@│-│
> ││-│@:│-││ │ │
> │└─┴──┴─┘│ │ │
> └────────┴─┴─┘
>    FetchAtomicRepr br 'f'
> ┌─┐
> │@│
> └─┘
>    a3=: (@: (FetchAtomicRepr f.)) ('ExecuteDoOnLeftArgAdverbWithLeftArg' f.)
>    RankInfinity=: "_
>     +RankInfinity
> +"_
>    EvokeGerundTrain=: `:6
>    (+/)`%`# EvokeGerundTrain 1 2 3
> 2
>    a6=: ((( ar'RankInfinity') ; ] ; ( ar'a3')"_)
> ('ExecuteDoOnLeftArgAdverbWithLeftArg'f.)) (`:6)
>    hg=: `((ar'a6')`(ar'EvokeGerundTrain')) (`:6)
>    1 2 3 ((<'*:') ; ]) hg
> 1 4 9
>    an=:  <@:((,'0') (,&<) ])  NB. Atomizing words (monadic verb)
>    an +`-`*`%
> ┌─────────────┐
> │┌─┬─────────┐│
> ││0│┌─┬─┬─┬─┐││
> ││ ││+│-│*│%│││
> ││ │└─┴─┴─┴─┘││
> │└─┴─────────┘│
> └─────────────┘
>    AdverbToPackvuGerundWithAt=:< o ((('@:') ; < o |.)) o (('';1)&{::) hg
>    (-`<) AdverbToPackvuGerundWithAt
> <@:-
>    3 (-`<) AdverbToPackvuGerundWithAt 2
> ┌─┐
> │1│
> └─┘
>    AdverbToPackReverseOrderGerundWithAt=: ([ , (<'@:') , ])/o |. o
> (('';1)&{::)hg
>    *:`-`%`+: AdverbToPackReverseOrderGerundWithAt
> +:@:%@:-@:*:
>    *:`-`%`+: AdverbToPackReverseOrderGerundWithAt 5
> _0.08
>    ConjunctionToExecuteVWithArgumentU=: ((an f.hg) (` (|. o
> ((('';1)&{::))hg)) (an f.hg))
>    1 2 3 ConjunctionToExecuteVWithArgumentU (+/)
> 6
>
>
> Cheers,
>
>
> Erling Hellenäs
>
>
>
> On 2017-10-21 21:52, Erling Hellenäs wrote:
>>
>> My a2 name :)
>>
>>     InfinityAdverb=: (`(<(":0);_)) (`:6)
>>
>> %InfinityAdverb
>>
>> 0
>>
>> /Erling
>>
>>
>> On 2017-10-21 20:45, Raul Miller wrote:
>>>
>>> Here's one issue:
>>>
>>>     1 2 3 *: av
>>> 1 4 9
>>>     load'debug/dissect'
>>>     dissect '1 2 3 *: av'
>>> Syntax error: invalid sequence Noun Verb
>>> Error snippet: 1 2 3 *: av
>>>
>>> But that's not a syntax error.
>>>
>>> And, for reference, here are two distinct implementations of av. First
>>> an explicit approximation:
>>>
>>> LR=: 5!:5@<
>>> LRA=:1 :0
>>>    (LR 'u'),' m'
>>> )
>>> AV=:1 :0
>>>    1 :(u LRA)
>>> )
>>>
>>> Second, a restatement of Jose's code (but with a few different names):
>>>
>>>     ar=: 5!:1@:<
>>>     bGerund=: `''
>>>     Compose=: (@:[) ((<'&')`) (`:6)
>>>     a2=: (`(<(":0);_)) (`:6)
>>>     av=: ((ar'bGerund')`)  (`(ar'Compose')) (`(ar'a2') ) (`:6)
>>>
>>> I am still trying to think up a good name for a2 - roughly speaking
>>> it's a placeholder which winds up being ignored in the result of the
>>> Compose verb. I was interested in what dissect had to show me about
>>> the evaluation process here, but that's not relevant to this problem,
>>> which you can see by replacing av with AV.
>>>
>>> #################################################
>>>
>>> That said, it's perhaps also interesting that trace is also buggy:
>>>
>>>      trace '1 2 3 *: AV'
>>>   --------------- 5 Fork -------
>>>   1 2 3
>>>   *:
>>>   AV
>>>   1 2 3 *: AV
>>>   ==============================
>>>
>>> The problem seems to be an incomplete handling of locales. While trace
>>> executes in the jtrace locale, the sentence it is executing comes from
>>> a different locale (typically the base locale). This means that 4!:0
>>> in movet treats AV as an undefined name (and, thus, a verb).
>>>
>>> A quick and dirty fix would be to add
>>> coinsert 'base'
>>> to the top of addons/general/misc/trace.ijs (right under
>>> cocurrent'jtrace').
>>>
>>> This has two flaws but it's still better than nothing:
>>>
>>> (1) it won't work when trying to trace in another locale,
>>> (2) it will still shadow base names with jtrace names.
>>>
>>> Problem 2 could be avoided by replacing uses of 4!:0 and ". with names
>>> which are defined in the z locale (nc and do), and suffixing them with
>>> locale references. Still not perfect (because relies on z), but
>>> implementations which shadow z are already dubious.
>>>
>>> I have no idea about problem 1 - maybe documentation would be the best
>>> solution there. (Another possibility would be to add feature to the
>>> locale support, to detect locale of the caller - but I can't think of
>>> any non-obfuscation uses of that feature. And, yes, ... I guess I
>>> might have to include "making jtrace automatically work regardless of
>>> the current locale of the global session" as obfuscation. I am not
>>> sure about that...)
>>>
>>> #################################################
>>>
>>> Anyways, since this is getting long, I have reported two problems here:
>>>
>>> (1) An invalid "syntax error" in dissect
>>> (2) A serious name resolution problem in trace
>>>
>>> Thanks,
>>>
>>
>> ----------------------------------------------------------------------
>> 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

Reply via email to