Not surprisingly, some of us have developed similar tools. I have a verb
(as) which, by chance, given your (sample) argument almost reproduces your
(target) product,
as'qq((a(bd(c))g)gg(ffff))g'
┌──┬──────────────────────────┬─┐
│qq│┌──────────────┬──┬──────┐│g│
│ ││┌─┬────────┬─┐│gg│┌────┐││ │
│ │││a│┌──┬───┐│g││ ││ffff│││ │
│ │││ ││bd│┌─┐││ ││ │└────┘││ │
│ │││ ││ ││c│││ ││ │ ││ │
│ │││ ││ │└─┘││ ││ │ ││ │
│ │││ │└──┴───┘│ ││ │ ││ │
│ ││└─┴────────┴─┘│ │ ││ │
│ │└──────────────┴──┴──────┘│ │
└──┴──────────────────────────┴─┘
The difference is that your product includes an extra empty box (which I
find puzzling).
The purpose of the fixed tacit verb (as) really is to "atomize" quoted
sentences in a form that the first-class verb train (or the adverb `:6) can
process. What follows assumes that the wicked tacit toolkit script [0] has
been run beforehand,
mRS=. (`'') (<&.:train f.av) (`,)(`]) (`:6) (train f. @: )
(&:(an f.))
The adverb mRS provides a recursion scope to monadic verbs [1],
parencuts=. _1 |. 0 = 1 _1 0 +/\@:{~ (;:'()') i. ] NB. (monadic verb)
parenexp=. < o $: o }. o }: NB. (monadic verb)
anonymousnoun=. ('''' = {.) +. (':' ~: {:) *. '_0123456789' e.~ {.
simple=. an o ". ^: anonymousnoun o ; &.: > NB. (monadic verb)
parenthesized=. (;:'()') -: {. , {: NB. (monadic verb)
dropNB=. }: ^: ('NB.' -: 3 {. > o {:)
as=. (, o (parencuts ((simple f.)`(parenexp f.)@.parenthesized);.1
])f.)mRS o dropNB o ;: f.
NB. (monadic verb)
Note that, despite of how parenexp is somewhat deceptively defined, it is
not, ultimately, the verb denoted by $: ; instead, $: denotes the
anonymous verb, which is the argument of mRS, embedded in as. This
anonymous verb is the recursive verb.
A general wicked method for writing fixed tacit adverbs (and fixed tacit
conjunctions in Jx) is to process the adverb (or conjunction) argument(s)
with a first-class verb (e.g., train o v) via train o v av or, more
generally, train o v adv (or train o v conj in Jx). The task of the
verb v is to produce a form that the first-class verb train can
handle. My motivation for writing the verb (as) was to exhibit instances
of the results, which one wants the verb v to produce, to facilitate the
design of the particular verb v.
In addition, the verb (as) also provides the means for writing an
equivalent recursive wicked variant of Dan's anonymous evoke adverb [2],
ae=. train o as f.av
'(*: +/ 1 2 3) - (+/ *: 1 2 3) NB. Producing a noun'ae
22
('((10{a.) I.@(e.&(13{a.))@]} ])@:(#~ -.@((13 10{a.)&E.@,)) NB.
Producing a verb') ae
((10{a.) I.@(e.&(13{a.))@]} ])@:(#~ -.@((13 10{a.)&E.@,))
'("1)(@:(>@:{)) NB. producing an adverb'ae
("1)(@:(>@:{))
'" NB. Producing a conjunction'ae
"
Incidentally, anonymous evoke is, to some extent, a misnomer for the adverb
(ae) because it really is an extension of the official evoke (~),
'bind'ae NB. Producing an explicit conjunction
2 : 'x@(y"_)'
In contrast to ~ , it can also handle names indirectly,
Y=. 1 2 3
'(*: +/ Y) - (+/ *: Y) NB. Extra parentheses for symmetric
clarity'ae
22
The one part of the speech the adverb ae cannot handle is the anomalous
copula; however, a Jx interpreter can,
'(*: +/ Y) - (+/ *: Y) [ Y=. 1 2 3 NB. Jx version of ~ '~
22
References
0. [Jprogramming] Tacit Toolkit (was dyadic J), Jose Mario Quintana
http://www.jsoftware.com/pipermail/programming/2015-December/043757.html
1. [Jprogramming] Adverbial Tacit Jym, Jose Mario Quintana
http://www.jsoftware.com/pipermail/programming/2016-May/045156.html
2. No subject [!]
http://www.jsoftware.com/pipermail/general/2009-April/033220.html
On Tue, Dec 20, 2016 at 7:47 PM, 'Pascal Jasmin' via Programming <
[email protected]> wrote:
> learned 2 things,
>
> (gerund);. existed all along, and
>
> ; on open data is the same as ,?
>
>
> this is what AltM builds
>
> +:`-: AltM
> }.@:((}.@] ,~ [ , +:@{.@])`(}.@] ,~ [ , -:@{.@])`:3)@:({. , ])
>
> it doesn't need the reshaping part that ;. does. My quick try at dropping
> altm into the recursive cutparen verb didn't work.
>
>
> ________________________________
> From: Jose Mario Quintana <[email protected]>
> To: Programming forum <[email protected]>
> Sent: Tuesday, December 20, 2016 6:19 PM
> Subject: Re: [Jprogramming] strand notation tools
>
>
> "pasting error, those are 2 lines"
>
> Thanks Pascal, for some reason they morphed into one in the forum archive
> [0].
>
> "
> (+:`-:AltM)("1) 3 3 3$1 2 3 4
> 2 1 6
> 8 0.5 4
> 6 2 2
>
> 4 1.5 8
> 2 1 6
> 8 0.5 4
>
> 6 2 2
> 4 1.5 8
> 2 1 6
> "
>
> In that case, the following definition is quite similat to AltM,
>
> altm=. ((;.1) (1:`) (`]) (`:6) (;@:)) (($`$)`) (`:6)
>
> u altm
> $ $ ;@:(1: u;.1 ])
>
> +:`-: altm
> $ $ ;@:(1: +:`-:;.1 ])
>
> +:`-: altm 1 2 3 4
> 2 1 6 2
>
> +:`-: altm("1) 3 3$ 1 2 3 4
> 2 1 6
> 8 0.5 4
> 6 2 2
>
> +:`-: altm("1) 3 3 3$ 1 2 3 4
> 2 1 6
> 8 0.5 4
> 6 2 2
>
> 4 1.5 8
> 2 1 6
> 8 0.5 4
>
> 6 2 2
> 4 1.5 8
> 2 1 6
>
> Though, it is not equivalent,
>
> (+:&.:>)`(-:&.:>) altm <("1) 3 3$1 2 3 4
> 2 4 6
> 2 0.5 1
> 6 8 2
>
>
> [0] [Jprogramming] strand notation tools
>
> http://www.jsoftware.com/pipermail/programming/2016-December/046241.html
>
>
>
>
>
>
> On Tue, Dec 20, 2016 at 1:09 PM, 'Pascal Jasmin' via Programming <
> [email protected]> wrote:
>
> >
> >
> >
> > pasting error, those are 2 lines
> >
> > lr_z_ =: 3 : '5!:5 < ''y'''
> >
> > daF =: 1 : 'a =. (''2 : '', (quote m) , '' u'') label_. 1 : (''u 1 :'' ,
> > quote a)'
> >
> >
> > (+:`-:AltM)("1) 3 3 3$1 2 3 4
> > 2 1 6
> > 8 0.5 4
> > 6 2 2
> >
> > 4 1.5 8
> > 2 1 6
> > 8 0.5 4
> >
> > 6 2 2
> > 4 1.5 8
> > 2 1 6
> > ________________________________
> > From: Jose Mario Quintana <[email protected]>
> > To: Programming forum <[email protected]>
> > Sent: Monday, December 19, 2016 7:21 PM
> > Subject: Re: [Jprogramming] strand notation tools
> >
> >
> > I tried to run your script but I was not able to go very far:
> >
> > JVERSION
> > Engine: j805/j64/windows
> > Beta-12: commercial/2016-09-30T15:50:47
> > Library: 8.05.09
> > Qt IDE: 1.5.2/5.6.1
> > Platform: Win 64
> > Installer: J805 install
> > InstallPath: g:/program files/j
> > Contact: www.jsoftware.com
> >
> >
> > isNoun =: (0 = 4!:0 ::0:)@:<
> > isgerund =: 0:`(0 -. at e. 3 : ('y (5!:0)';'1')"0)@.(0 < L.) :: 0:
> > isgerundA =: 1 : ' if. isNoun ''u'' do. isgerund m else. 0 end.'
> > eval =: 1 : ' a: 1 : m'
> > ar =: 1 : '5!:1 <''u'''
> > aar =: 1 : 'if. isNoun ''u'' do. q =. m eval else. q =. u end. 5!:1 <
> > ''q'' '
> >
> > tie =: 2 : 'if. u isgerundA do. if. v isgerundA do. m ar , v ar
> else. m
> > , v ar end. else. if. v isgerundA do. u ar , n else. u ar , v ar end.
> end.
> > '
> > tieA =: 2 : 'if. u isgerundA do. if. v isgerundA do. m ar , v ar
> else.
> > m , v aar end. else. if. v isgerundA do. u aar , n else. u aar , v aar
> > end. end. '
> >
> >
> > + tie '/'
> > ┌─┬─────┐
> > │+│┌─┬─┐│
> > │ ││0│/││
> > │ │└─┴─┘│
> > └─┴─────┘
> >
> >
> > + tieA '/\'
> > ┌─┬─────────┐
> > │+│┌─┬─────┐│
> > │ ││4│┌─┬─┐││
> > │ ││ ││/│\│││
> > │ ││ │└─┴─┘││
> > │ │└─┴─────┘│
> > └─┴─────────┘
> >
> >
> > lr_z_ =: 3 : '5!:5 < ''y'''daF =: 1 : 'a =. (''2 : '', (quote m) , ''
> > u'') label_. 1 : (''u 1 :'' , quote a)'
> > |value error
> > | a=.('2 : ',(quote m),' u')
> >
> >
> ----------------------------------------------------------------------
> 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