Pascal wrote: "seems like there is a need for a new primitive say `.. (tie below)"
The Jx primitive `. (knot) does the following: 1`.+ ┌─────┬─┐ │┌─┬─┐│+│ ││0│1││ │ │└─┴─┘│ │ └─────┴─┘ +/`.1 2 3 4 ┌───────┬───────────┐ │┌─┬───┐│┌─┬───────┐│ ││/│┌─┐│││0│1 2 3 4││ ││ ││+│││└─┴───────┘│ ││ │└─┘││ │ │└─┴───┘│ │ └───────┴───────────┘ +/`.1 2 3 4 `:6 10 See [0] and references there in. [0] [Jprogramming] J Extensions, Jose Mario Quintana http://www.jsoftware.com/pipermail/programming/2014-March/036377.html On Thu, Jan 5, 2017 at 8:53 PM, 'Pascal Jasmin' via Programming < programm...@jsoftware.com> wrote: > there is always the ugliness that lr spits out > > lr (1 ar)`+ > (<(,'0');1),<,'+' > > (but parenthesized in case it is bound to modifier) > > > One solution would be to make an exception for noun ARs, i. e. those > beginning with (<'0'). Those could be left in boxed form, rather than > converted back to their value, when they appear as operands to (`). > > > This sounds promising, so > > (<(,'0');1)`+ > > seems like there is a need for a new primitive say `.. (tie below) > > > ar =: 1 : '5!:1 <''u''' > isNoun_z_ =: (0 = 4!:0 ( :: 0:))@:< > isgerund =: 0:`(0 -.@e. 3 : ('y (5!:0)';'1')"0)@.(0 < L.) :: 0: > isgerundA =: 1 : ' if. isNoun ''u'' do. isgerund m else. 0 end.' > 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. ' > > so the above could be displayed (lr) and input as > > 1`..+ > > but > > > (<(,'0');1)`+ > > wouldn't break anything since its a valid lr that creates the valid > gerund. I can't imagine anyone was relying on buggy lr output that doesn't > convert back to ar form. > > > > > ----- Original Message ----- > From: Henry Rich <henryhr...@gmail.com> > To: programm...@jsoftware.com > Sent: Thursday, January 5, 2017 8:20 PM > Subject: Re: [Jprogramming] fixed tacit produces an error when reassigned > > I understand this problem a little better now. > > The trouble would be something like > > v0`v1`n2`v3 > > where the n2 is a user-created AR. How should you convert this back to > linear rep? > > There are no fingerprints to indicate that a gerund was created by (`) > turning a verb into an AR. So when the LR is generated, any AR that is > an operand to (`) is assumed to have been created by (`). > > One solution would be to make an exception for noun ARs, i. e. those > beginning with (<'0'). Those could be left in boxed form, rather than > converted back to their value, when they appear as operands to (`). > > Would that change break anything? > > Henry Rich > > > > On 1/3/2017 9:37 PM, Henry Rich wrote: > > Operands to modifiers such as m}, ^:n, m`, and `n are flagged if they > > are recognized as gerunds. > > > > This seems to me to be a mistake for m` and `n: they should not be > > flagged until the derived adverb has been executed. The problem you > > report is that m/n are interpreted as if they had come from converting > > a noun to an AR, rather than as a noun in themselves. > > > > But Roger said it was an error in 5!:5. When Roger diagnoses a > > problem differently from me, I assume I am wrong. I'll have to go > > think about it. > > > > In the meantime, you can consider whether there would be a problem > > with delaying the recognition of m` and `n until the derived verb is > > executed. > > > > Henry Rich > > > > > > > > On 1/3/2017 11:18 AM, Jose Mario Quintana wrote: > >> Sorry, I pressed the wrong button and my previous message was > >> incomplete; > >> this should have been the full message: > >> > >> I am afraid it is the superbug that has been discovered and > >> rediscovered a > >> few times; see [0, 1, 2 and 3]. > >> > >> References > >> > >> [0] [Jprogramming] Table of Verbs, Jose Mario Quintana > >> http://www.jsoftware.com/pipermail/programming/2013-April/032358.html > >> > >> [1] [Jprogramming] tacit adverb, Dan Bron > >> http://www.jsoftware.com/pipermail/programming/2012-February > /027341.html > >> > >> [2] [Jgeneral] Looks like a bug in "., Dan Bron > >> http://www.jsoftware.com/pipermail/general/2009-August/033231.html > >> > >> [3] [Jprogramming] Linear Representation Bug?, Roger Hui > >> http://www.jsoftware.com/pipermail/programming/2009-August/016011.html > >> > >> > >> On Tue, Jan 3, 2017 at 11:09 AM, Jose Mario Quintana < > >> jose.mario.quint...@gmail.com> wrote: > >> > >>> I am afraid it is the superbug that has been discovered and > >>> rediscovered a > >>> few times; see [0, 1, 2 and 3]. > >>> > >>> > >>> References > >>> > >>> [0] [Jprogramming] Table of Verbs, Jose Mario Quintana > >>> http://www.jsoftware.com/pipermail/programming/2013-April/032358.html > >>> > >>> [1] [Jprogramming] tacit adverb, Dan Bron > >>> http://www.jsoftware.com/pipermail/programming/2012-February > >>> /027341.html > >>> > >>> [2] [Jgeneral] Looks like a bug in "., Dan Bron > >>> http://www.jsoftware.com/pipermail/general/2009-August/033231.html > >>> > >>> > >>> On Tue, Jan 3, 2017 at 10:12 AM, 'Pascal Jasmin' via Programming < > >>> programm...@jsoftware.com> wrote: > >>> > >>>> This file works j804 and j805, when copied and run with F8, you may > >>>> need > >>>> to fix newlines > >>>> > >>>> > >>>> > >>>> > >>>> NB.--------------------------------------------------------- > >>>> ------------------- > >>>> NB. Wicked Tacit Toolkit... > >>>> NB.--------------------------------------------------------- > >>>> ------------------- > >>>> > >>>> NB. Load it using 0!:0 or similar or > >>>> NB. paste it on an J editing window and use Crtl-A Crtl-E or > >>>> NB. of course, load it using a hot key (or replace '=.' by '=:' if you > >>>> must) > >>>> > >>>> NB. A word is a noun, verb, adverb or conjunction > >>>> > >>>> > >>>> (_ o=. @:) (c=. "_) (e=. &.>) (x=. @:[) (y=. @]) > >>>> > >>>> an=. <@:((,'0') ,&< ]) NB. Atomizing words (monadic verb) > >>>> > >>>> Cloak=. (0:`)(,^:) NB. Cloaking (the atomic > >>>> representaions > >>>> of) > >>>> NB. adverbs or conjunctions as monadic or > >>>> NB. dyadic verbs (adv) > >>>> Cloak=. ((5!:1)@:<'Cloak')Cloak NB. Cloak verbing itself! (monadic > >>>> ver) > >>>> > >>>> 'amper at evoke fix rank tie'=. Cloak o < e o ;: '& @: `: f. " `' > >>>> NB. Verbing some adverbs and conjunctions > >>>> > >>>> train=. (evoke&6) :. an f. NB. (`:6) with a convinient obverse > >>>> NB. (monadic verb) > >>>> box=. (< o train "0) f. NB. Boxing primitives and pro-words > >>>> NB. (monadic verb) > >>>> > >>>> af=. an o fix > >>>> > >>>> (a0=. `'') (a1=. (@:[) ((<'&')`) (`:6)) (a2=. (`(<(":0);_)) (`:6)) > >>>> av=. ((af'a0')`) (`(af'a1')) (`(af'a2') ) (`:6) > >>>> NB. Adverbing a monadic verb (adv) > >>>> assert 1 4 9 -: 1 2 3 *: adv > >>>> > >>>> aw=. < o ((0;1;0)&{::) NB. Fetching the atomic representation > >>>> > >>>> u (a3=. (o (train o aw f.)) ('av'f.)) (a4=. "_) > >>>> > >>>> adv=. train o ((af'a4') ; ] ; (af'a3')"_) f.av > >>>> assert 1 4 9 -: 1 2 3 *: adv > >>>> assert 6 -: * (,^:(0:`(<'/'))) adv 1 2 3 > >>>> assert 0 1 3 -: (*:`(+/\)) (train f. o (0&{ , (<'-') , 1&{)) adv 1 2 3 > >>>> > >>>> a3=. (o (aw f.)) ('av'f.) > >>>> > >>>> Adv=. (train f. @:) (train o ((af'a4') ; ] ; (af'a3')"_) f.av) > >>>> assert 1 4 9 -: 1 2 3 ((<'*:') ; ] ) Adv > >>>> assert 6 -: * (< , ((<'/')"_)) Adv 1 > >>>> 2 3 > >>>> assert 0 1 3 -: (*:`(+/\)) (0&{ , (<'-') , 1&{)@:(('';1)&{::) Adv 1 > >>>> 2 3 > >>>> > >>>> Ver=. Cloak o af f. NB. Verbing after fixing a pro-adverb or > >>>> pro-conjunction > >>>> NB. (monadic verb) > >>>> ver=. Cloak o an f. NB. Verbing after fixing an adverb or conjunction > >>>> NB. (monadic verb) > >>>> > >>>> NB. Defining cv in terms of itself... > >>>> cv=. ((rank&_) o < o train)f.adv (>@:) NB. First version > >>>> cv=. (train f. cv at (<x rank _ c)) f.adv NB. Constant verb > >>>> u ( cv=. ( >cv at (<x rank _ c)) f.adv ) > >>>> NB. Constant word (adv) > >>>> NB. (cv is to words as c is to nouns) > >>>> assert (CRLF cv _) -: CRLF > >>>> assert (u cv _) <adv -: u <adv > >>>> assert (!@# cv _) <adv -: !@# <adv > >>>> assert (< o ((Ver'cv') o train <'/') _) -: ( < o train (<'/')) > >>>> assert (< o ((Ver'cv') o train <'"') _) -: ( < o train (<'"')) > >>>> > >>>> > >>>> NB. Fetch and From... > >>>> pointers=. (<: o - o i.)`i. @.(0<]) > >>>> > >>>> Fetch=. (] amper {:: cv)e o pointers f.adv NB. Verbs mnemonics > >>>> pointers > >>>> NB. (e.g., ( 'u0 u1 u2 u3'=. 4 Fetch ) j ( 'v0 v1 v2 v3'=. _4 Fetch > >>>> ) ) > >>>> > >>>> assert (< o train 3 Fetch) -: ( 0&({::) 1&({::) 2&({::)) (< adv) > >>>> assert (< o train _3 Fetch) -: (_3&({::) _2&({::) _1&({::)) (< adv) > >>>> > >>>> From=. (] amper { cv)e o pointers f.adv NB. Verbs mnemonics > >>>> pointers > >>>> NB. From=. (] ([ amper train y)(({ `'')c))e o i. f. adv > >>>> NB. (e.g., ( 'u0 u1 u2 u3'=. 4 From ) j ( 'v0 v1 v2 v3'=. _4 From ) ) > >>>> > >>>> assert (< o train 3 From ) -: ( 0&{ 1&{ 2&{ ) (<adv) > >>>> assert (< o train _3 From ) -: (_3&{ _2&{ _1&{ ) (<adv) > >>>> > >>>> Left=. (at [cv)e f.adv > >>>> Right=. (at ]cv)e f.adv > >>>> > >>>> mRS=. (`'') (<&.:train f.av) (`,)(`]) (`:6) (train f. @: > >>>> )(&:(an f.)) > >>>> NB. Monadic recursion scope > >>>> assert (1 + (1:`(* $:@<:)@.*) mRS 4) -: 25 NB. Factorial > >>>> fixed > >>>> dRS=. (`'') (<&.:train f.av) (`,) (`]) (,`) ([`) (`:6) (train f. @: > >>>> )(&:(an f.)) > >>>> NB. Dyadic recursion scope > >>>> assert (3 (1 + (1:`(%~ * $:&:<:)@.(*@:[))dRS) 7) -: 36 NB. > >>>> Binomial fixed > >>>> > >>>> > >>>> mRS is properly assigned and works as intended from file, > >>>> > >>>> > >>>> mRS > >>>> ((((((`'')(((`'')(&(<&.:(,^:(0:``:)&6 :.(<@:((,'0') ,&< > >>>> ])))@:[)))((`_)(`:6))))(`,))(`]))(`:6))(,^:(0:``:)&6 :.(<@:((,'0') > ,&< > >>>> ]))@:))(&:(<@:((,'0') ,&< ]))) > >>>> > >>>> but trying to to assign it to this linear representation produces a > >>>> syntax error > >>>> > >>>> mRS =: ((((((`'')(((`'')(&(<&.:(,^:(0:``:)&6 :.(<@:((,'0') ,&< > >>>> ])))@:[)))((`_)(`:6))))(`,))(`]))(`:6))(,^:(0:``:)&6 :.(<@:((,'0') > ,&< > >>>> ]))@:))(&:(<@:((,'0') ,&< ]))) > >>>> |syntax error > >>>> > >>>> > >>>> > >>>> is this a bug in linear representation? is it directly assignable? > >>>> ------------------------------------------------------------ > ---------- > >>>> For information about J forums see http://www.jsoftware.com/forum > s.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 > > ---------------------------------------------------------------------- > 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