[Jprogramming] Trains: past, present and ...

Erling Hellenäs erling at erlinghellenas.se
Sat Oct 21 23:27:44 UTC 2017


    1 (<'+')(`:6) 3
4
    ((<('+';'/')))(`:6) 1 2 3
6
    ((<('+';'/');'%';'#'))(`:6) 1 2 3
2
    (< (<'-');'@:';<(<'+:')) (`:6)1 2 3
_2 _4 _6

/Erling

On 2017-10-21 23:25, Raul Miller wrote:
> Ok... i do not know how to approach this without reviewing basics,
> so... bear with me.
>
> The question is how does a3 work. And, a3 is:
>
>     a3=: (@: (aw f.)) av
>
> aw extracts the left tine of the gerund of a train or analogous sequence:
>
>     9!:3]1 5   NB. show both atomic and linear representations
>
>     1:a4    NB. raw example verb
> ┌──────────────┐
> │┌─┬──────────┐│
> ││"│┌──┬─────┐││
> ││ ││1:│┌─┬─┐│││
> ││ ││  ││0│_││││
> ││ ││  │└─┴─┘│││
> ││ │└──┴─────┘││
> │└─┴──────────┘│
> └──────────────┘
> 1:"_
>     aw 1:a4 bGerund    NB. using aw to extract left tine from our example
> ┌──┐
> │1:│
> └──┘
>
> And, remember, av derives and adverb from a monadic verb (such that
> the adverb result on the adverb argument is what the verb argument
> would have been from the verb argument).
>
> The trick seems to be that a3 seemingly produces a gerund result but
> it passes that result to @: (and the verb which is derived by @: is
> then transformed to an adverb by av).
>
> If I understand right, the only way this can work is if a3 is not
> really operating on gerunds but is actually operating on J's internal
> structure for tacit functions (they are structured like gerunds but
> don't need `:6 to turn them into verbs because they already are verbs
> - and this would also apply for adverbs and conjunctions - basically
> it's a tree structure with each element of that tree having a type, so
> whatever you extract from it has the type of that element).
>
> This ... feels like the sort of obscurity that people talk at length
> about (and skirt around) when discussing type theory and higher level
> functions. I'm still waffling about what I think about it myself. Jose
> really likes it though.
>
> ##################
>
> Meanwhile, a6 is something of a wrapper for this aw based mechanic.
> It's building up a template verb to build a gerund, using av to make
> that an adverb, then using `:6 on the result of executing that
> template against the adverb argument.
>
>     a6=: ((( ar'a4') ; ] ; ( ar'a3')"_) av) (`:6)
>
> Conceptually, it's sort of like 1 :'a4 u a3' but that rephrasing loses
> track of the type and tree structure issues.
>
> Thanks,
>



More information about the Programming mailing list