I came up with something similar to your mu function, or more precisely, more 
similar to Dan's strand notation.

at bottom of this page:
http://www.jsoftware.com/jwiki/PascalJasmin/double%20adverbs%20vs%20conjunctions

appologies for duplicating your names.

The improvement over Dan's work is the ability to pair the strand parser with 
another adverb to process the accumulated sentence.  It is optimized for `:n. 
,and other adverbs that take gerunds.

The improvement that it needs is a general function to convert from gerunds to 
linear representation (on a per verb phrase basis would be fine).


----- Original Message -----
From: Jose Mario Quintana <[email protected]>
To: Programming forum <[email protected]>
Cc: 
Sent: Monday, February 16, 2015 1:36 PM
Subject: [Jprogramming] Can whatever be written tacitly?

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,

   ". noun define -. CRLF

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
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to