I wrote: " Dan, if you are reading this ... I wonder if you wrote a recursive prototype for nest2Box, or if you could write one, which you could share. "
Dan, never mind; I found: http://www.jsoftware.com/pipermail/programming/2011-November/025493.html and I should be able to take it from there. I also wrote: " Mu shines when it facilitates writing (tacit) adverbs (and "multiple" tacit adverbs). That was the reason that prompted me to write the lambda adverb (mu's sibling) in the first place. I will elaborate on the production of adverbs, via mu, another day. " Today is another day. This is another try at implementing the adverb (`:4) described in [0]. It has been almost a year since my first one [1]. Let us keep going in high gear well above the speed limit, JVERSION Installer: j602a_win.exe Engine: j701/2012-12-06/12:20/x Library: 6.02.023 evoke4=. [: v0 v1 v2 v3 'v1`(v2 $:@:v3)@.v0' mu fact=. evoke4 *`1:`*`<: fact 5 120 fib=. evoke4 >&1`(i.@>:)`(] , +/@(_2&{.)@])`<: fib 7 0 1 1 2 3 5 8 13 But that does not really implement the adverb `:4 because evoke4 is a wicked verb. Let us sweep the black magic under the carpet then, Evoke4=. [: v0 v1 v2 v3 'v1`(v2 $:@:v3)@.v0' mu adv fact=. *`1:`*`<: Evoke4 fact 5 120 fib=. >&1`(i.@>:)`(] , +/@(_2&{.)@])`<: Evoke4 fib 7 0 1 1 2 3 5 8 13 What is adv? It is an adverb that adverbializes a verb. It is easily defined in Jx but it can be also produced, without breaking any speed limit, using an official interpreter (see, for example, the definition of Adv0 in [1]); one can even use mu to produce such an adverb. Let us continue with the path set in [1] and produce a "quadruple" adverb (Ev4) using strand style (without the intrusive `) that does not require a cap. The adverb Evoke4 together with the adverb sna in [1] can produce the wanted adverb Ev4 but there is a better way. Ev4=. [: v0 v1 v2 v3 'v1`(v2 $:@:v3)@.v0' kappa fact=. * 1: * <: Ev4 fact 5 120 fib=. >&1 (i.@>:) (] , +/@(_2&{.)@]) <: Ev4 fib 7 0 1 1 2 3 5 8 13 What is kappa? It is a "multiple" adverb that produces another adverb with "multiplicity' equal to the number of arguments; kappa is lambda's twin. Ev4=. [: v0 v1 v2 v3 (v1`(v2 $:@:v3)@.v0) lambda fact=. * 1: * <: Ev4 fact 5 120 fib=. >&1 (i.@>:) (] , +/@(_2&{.)@]) <: Ev4 fib 7 0 1 1 2 3 5 8 13 Lambda takes directly the defining sentence without quotes and has certain advantages over kappa for producing adverbs. It follows a different approach that depends neither on a verbalized agenda, nor gTxt nor nest2Box. The latest version of Jx is still evolving but the intention is to make the patches for the extensions available once it settles. [0] Bernecky, Robert, and R.K.W. Hui, *Gerunds and Representations*, APL91, ACM. http://dl.acm.org/citation.cfm?id=114059 [1] Tacit recursion without $: http://www.jsoftware.com/pipermail/programming/2014-February/035416.html On Mon, Feb 16, 2015 at 1:36 PM, Jose Mario Quintana < [email protected]> wrote: > > Can whatever be written tacitly? Depending on the type of whatever (verb, > adverb or conjunction) the answers are respectively yes, yes, and no. Any > explicit verb or adverb can always be ,in principle, rewritten tacitly. No > (user-defined) conjunctions can be produced tacitly (using a current > official interpreter). > > The question that follows is: How can whatever (explicit) verb or adverb > be rewritten tacitly? > > Not surprisingly, many challenging questions posted on the forum involve > explicit one-liners verbs such that the explicit-to-tacit conversion form > 13 : '…' produces back explicit verbs instead of the wanted tacit verbs > because the 13 : '…' requirement "every explicit sentence with one or two > arguments which does not use the argument(s) as an operator argument" is > not fulfilled. A sample list is [0,1,2,3,4]. > > I realized recently that this kind of challenges could be solved in a > flash, if one is prepared to come to the dark side. In other words, > another one bites the dust... as long as one is willing to be literally > incorrect. Yes! :) > > A challenge, for example, in the thread corresponding to [4] was to > produce a tacit counterpart (f1) of f0 where, > > JVERSION > Installer: j602a_win.exe > Engine: j803/2014-10-19-11:11:11 > Library: 6.02.023 > > f0=. 4 :'x @.0&.>/y'"_1 > > F0=. ((-~ +/)"1)`((*~ +/)"1)`((+~ +/)"1)`((%~ +/)"1) > R0=. >: i. 5 > D0=. (i.5 3);(i.5 2);(i.5 4);(i.5 3) > > |.F0 f0 (<R0),. D0 > ┌───────────────────┬──────────────┬──────────────┬──────────────┐ > │ 3 1.5 1 0.75 0.6│ 7 8 9 10 11│ 1 2 3 4 5│ 2 1 0 _1 _2│ > │12 6 4 3 2.4│23 24 25 26 27│ 5 10 15 20 25│11 10 9 8 7│ > │21 10.5 7 5.25 4.2│39 40 41 42 43│ 9 18 27 36 45│20 19 18 17 16│ > │30 15 10 7.5 6│55 56 57 58 59│13 26 39 52 65│29 28 27 26 25│ > │39 19.5 13 9.75 7.8│71 72 73 74 75│17 34 51 68 85│38 37 36 35 34│ > └───────────────────┴──────────────┴──────────────┴──────────────┘ > > A quick solution is, > > > > > f1=. > ((<<0 6),(<(<,'X'),(<'@.'),(<<(,'0');0),(<'&.'),(<,'>'),(<,'/'),<, > 'Y'),<(,0);(,1);(,2);(,3);(,4);(,5);,6)&((1&({::) > ((<'@.') (0:`)(,^:)) 2&({: > :))@:(<@:((0: 0&({::)@:]`(<@:(1&({::))@:])`(2&({::)@:])} ])@:(3 0 > 1&{)) 1} ])@:(, <))@:,&:(<@:((,'0') ,&< ]))"_1 > > ) > > |.F0 f1 (<R0),. D0 > ┌───────────────────┬──────────────┬──────────────┬──────────────┐ > │ 3 1.5 1 0.75 0.6│ 7 8 9 10 11│ 1 2 3 4 5│ 2 1 0 _1 _2│ > │12 6 4 3 2.4│23 24 25 26 27│ 5 10 15 20 25│11 10 9 8 7│ > │21 10.5 7 5.25 4.2│39 40 41 42 43│ 9 18 27 36 45│20 19 18 17 16│ > │30 15 10 7.5 6│55 56 57 58 59│13 26 39 52 65│29 28 27 26 25│ > │39 19.5 13 9.75 7.8│71 72 73 74 75│17 34 51 68 85│38 37 36 35 34│ > └───────────────────┴──────────────┴──────────────┴──────────────┘ > > How was f1`s code produced? Quite easily, using the latest version of a > modified interpreter (Jx) that takes literacy incorrectness to new lows... > > JVERSION > Installer: j602a_win.exe > Engine: j701/2012-12-06/12:20/x > Library: 6.02.023 > > f1=. [: X Y 'X @.0&.>/Y' mu o ,&:an f. "_1 f. > > The rest required to wrap and repair its linear representation (for the > purpose of showing f1 to this forum running on an official interpreter), > > 66 (Wrap=.-@:[ ]\ 5!:5@<@:]) 'f1' > ((<<0 6),(<(<,'X'),(<'@.'),(<<(,'0');0),(<'&.'),(<,'>'),(<,'/'),<, > 'Y'),<(,0);(,1);(,2);(,3);(,4);(,5);,6)&((1&({::) ,^:(0:`@.) 2&({: > :))@:(<@:((0: 0&({::)@:]`(<@:(1&({::))@:])`(2&({::)@:])} ])@:(3 0 > 1&{)) 1} ])@:(, <))@:,&:(<@:((,'0') ,&< ]))"_1 > > ((<'@.') (0:`)(,^:)) > ,^:(0:`@.) > > The definitions of an and o are, > > an > <@:((,'0') ,&< ]) > > o > @: > > What is mu? > > 66 Wrap 'mu' > (2?:(<(,'0');({:@:] (?:(<'`:'))&6 :.(<@:((,'0') ,&< ]))@:, <@:((,' > 0') ,&< ])@:(?:(<'`.')))`((?:(<'`:'))&6 :.(<@:((,'0') ,&< ]))@:({: > ; <@:((,'0') ,&< ])@:}:)@:}:@:])@.(>@:((<[:)"_) -: [)))((<(,'0'); > ([ (?:(<,'&')) >@:])&(<(1&({::) ,^:(0:`@.) 2&({::))@:(<@:((0: 0&({ > ::)@:]`(<@:(1&({::))@:])`(2&({::)@:])} ])@:(3 0 1&{)) 1} ])@:(, <) > )@:(1 2 3&{)@:(<@:(<@:(2&({::) (i."_ 0) 1&({::))) 1} ])@:((((,&< ~ > .)@:[ (1&({::)@:[ ,&< (1&({::)@:[ i. ] { 0&({::)@:[)L:_ 0) ]) ((;: > '()') >@:{.^:(1 = #)L:1^:_@:(>@:{.L:1)@:((('';1) <@:,;.1 ] <@:(}.@ > :}:^:(1 < #));.2&>~ (= <./)&.>@:{:)L:1^:(1 + >./@:>@:{:))@:(i.@#@] > ,&< +/\@:(-/)@:(=/)) ]))@:((<@:((,'0') ,&< ])@:".@:]^:[&.>~ ([: ( > ('''' = {.) +. (':' ~: {:) *. '_0123456789' e.~ {.)@|: 2 {.&> ]))@ > :(}.~ (_1 * 'NB.' (('.:' e.~ {:@]) < (-: }:)) 4 {.&> {:))@:;:)@:(( > ?:(<'`:'))&6 :.(<@:((,'0') ,&< ])))@:{:@:(0&({::)) 2 3} ])@:(<@:(} > :@:(0&({::))) 1} ])@:('W E I'&(] , ;:@:[))@:<),<(,'0');(2?:(<(,'0' > );({:@:] (?:(<'`:'))&6 :.(<@:((,'0') ,&< ]))@:, <@:((,'0') ,&< ])@ > :(?:(<'`.')))`((?:(<'`:'))&6 :.(<@:((,'0') ,&< ]))@:({: ; <@:((,'0 > ') ,&< ])@:}:)@:}:@:])@.(>@:((<[:)"_) -: [)))) > > Alright, alright; its linear representation is seriously faulty anyway. > In English words: mu is an adverb written after its sibling adverb lambda > which I have mentioned before. Mu allows the production of a wicked verb > specified by a sentence written in a lambda/strand notation style. The > sentence implies the sequential production of multiple adverbs that > culminates with the production of the wicked verb. For example mu in the > sentence ( [: X Y 'X @.0&.>/Y' mu ) is what Pascal could refer as a > "multiple" adverb, in this particular case, a "quadruple" adverb [5]. > > Dan, if you are reading this, you might have noticed that you very own > nest2Box and gTxt verbs [6] are embedded in mu; thanks for writing and > sharing them. I understand your reasons for writing nest2Box cutting > bottom-up rather than recursing top-down. However, one can now embed > anonymous recursive verbs even when one is using an official interpreter. > I wonder if you wrote a recursive prototype for nest2Box, or if you could > write one, which you could share. I am curious if a possible TCO Jx > version of nest2Box could be competitive. > > What else can mu allow one to do? > > plus=. [: X Y 'X+Y NB. Are X and Y nouns or verbs?' mu > type'plus' > ┌────┐ > │verb│ > └────┘ > > plus o (an"0) 2 3 NB. Plus producing a noun > 5 > 2 plus o (an"0) o , 3 > 5 > plus 2`.3 NB. `. is a Jx extension > 5 > > plus *`% NB. Plus producing a verb :) > * + % > (*`'') plus o , (%`'') > * + % > 1 2 3 (*`'') plus o , (%`'') 4 5 6 > 4.25 10.4 18.5 > > plus 2`.% > 2 + % > plus 2`.% 3 4 5 > 2.33333333 2.25 2.2 > > Mu allows the use multiple formal parameters, continuing with the applying > gerund example [4], > > g0=. [: F D R '|.F f1 (<R),. D NB. Three parameters' mu o (an e) f. > NB. "Quintuple" adverb > > g0 (F0;D0;R0) NB. Boom shakalaka! > ┌───────────────────┬──────────────┬──────────────┬──────────────┐ > │ 3 1.5 1 0.75 0.6│ 7 8 9 10 11│ 1 2 3 4 5│ 2 1 0 _1 _2│ > │12 6 4 3 2.4│23 24 25 26 27│ 5 10 15 20 25│11 10 9 8 7│ > │21 10.5 7 5.25 4.2│39 40 41 42 43│ 9 18 27 36 45│20 19 18 17 16│ > │30 15 10 7.5 6│55 56 57 58 59│13 26 39 52 65│29 28 27 26 25│ > │39 19.5 13 9.75 7.8│71 72 73 74 75│17 34 51 68 85│38 37 36 35 34│ > └───────────────────┴──────────────┴──────────────┴──────────────┘ > > Mu shines when it facilitates writing (tacit) adverbs (and "multiple" > tacit adverbs). That was the reason that prompted me to write the lambda > adverb (mu's sibling) in the first place. I will elaborate on the > production of adverbs, via mu, another day. It is ironic that naming > arguments facilitates the production of some kind of verbs and adverbs that > do not name arguments. Oh well, "We do what we have to do so that we can > do what we want to do." > > [0] Conjunction in tacit verb > > http://www.jsoftware.com/pipermail/programming/2015-January/040965.html > > [1] Substitution with under > http://www.jsoftware.com/pipermail/programming/2014-May/037213.html > > [2] Tacit? > > http://www.jsoftware.com/pipermail/programming/2014-January/034499.html > > [3] Tacit help needed > > http://www.jsoftware.com/pipermail/programming/2009-August/015798.html > > [4] Applying gerund > > http://www.jsoftware.com/pipermail/programming/2009-August/016023.html > > [5] Double adverbs vs conjunctions > > http://www.jsoftware.com/jwiki/PascalJasmin/double%20adverbs%20vs%20conjunctions > > [6] Anonymous Evoke (ae), take 2 > > http://www.jsoftware.com/svn/DanBron/trunk/environment/anonymous_evoke2.ijs > > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
