A gerund is a different data type from a verb. (Jose has been playing with an exploit which lets gerunds contain verbs.)
Thanks, — Raul On Sunday, September 2, 2018, 'Pascal Jasmin' via Programming < [email protected]> wrote: > I believe you are referring to an unreleased beta? > +:`'' creates a rank 1 gerund? +:`'' `:6 would crash? > beta i does not crash doing this. So I am likely misunderstanding what > you suggest "should" crash, and that perhaps a more gentle behaviour could > be requested once I do understand what is meant by a crash condition. > > > On Sunday, September 2, 2018, 11:10:25 a.m. EDT, Henry Rich < > [email protected]> wrote: > > Pepe reported recently that some code using non-standard J (viz verbs > that return non-nouns) stopped working for beta-g, and supplied an example. > > In beta-g and later, code has been streamlined to take advantage of the > fact that all verbs are internally represented as atoms with the VERB > type. The failing code was trying to execute a block that was stored as > a VERB type with rank 1. This now crashes. Converting verbs to atoms > before execution might cover over the problem. > > Needless to say, there is no guarantee that non-standard code will be > portable over machines, releases, or state lines. > > Henry Rich > > > > On 8/22/2018 6:16 PM, Jose Mario Quintana wrote: > > I also think that instance conforms to the specification. A variant of > ART > > (perhaps more direct) is, > > > > ART=. (an`(0 { '' tie~ ]))@.(2097152 = 3!:0) adv > > > > > > On Wed, Aug 22, 2018 at 9:44 AM, Raul Miller <[email protected]> > wrote: > > > >> (I thought that this was documented behavior?) > >> > >> Thanks, > >> > >> — > >> Raul > >> > >> On Wednesday, August 22, 2018, 'Pascal Jasmin' via Programming < > >> [email protected]> wrote: > >> > >>> You've brought up another undocumented feature. > >>> '' $ 1 > >>> 1 > >>> '' $ , 1 > >>> > >>> 1 > >>> '' $ i.2 2 > >>> 0 1 > >>> > >>> '' $ 1 2 > >>> 1 > >>> '' $ ,: 1 2 > >>> > >>> 1 2 > >>> > >>> '' $ i.0 > >>> > >>> |length error > >>> > >>> > >>> > >>> '' $ y returns the first item of y if one exists. The difference with > {. > >>> is that the latter will fill if no item exists. > >>> > >>> > >>> > >>> On Tuesday, August 21, 2018, 5:12:37 p.m. EDT, Jose Mario > Quintana < > >>> [email protected]> wrote: > >>> > >>> > (2097152 = 3!:0) is undocumented magic that detects a verb (phrase). > >> Is > >>> there any similar magic number that > would detect a string/ar > >>> representation of modifiers? > >>> > >>> Yes, I normally mask the standard library verb datatype (datatype_z_) > >> with > >>> this alternative version, > >>> > >>> datatype=. (<;._1 > >>> '|boolean|literal|integer|floating|complex|boxed|extended| > >> rational|sparse > >>> boolean |sparse literal|sparse integer|sparse floating|sparse > >>> complex|sparse boxed |symbol > >>> |unicode|unicode4|?|?|verb|adverb|conjunction') >@{~ 1 2 4 8 16 32 64 > >> 128 > >>> 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1048576 > >> 2097152 > >>> 4194304 8388608 i. 3!:0 > >>> > >>> Wrap=. -@:[ ]\ 5!:5@<@:] > >>> > >>> 66 Wrap 'datatype' > >>> (<;._1 '|boolean|literal|integer|floating|complex|boxed|extended|r > >>> ational|sparse boolean |sparse literal|sparse integer|sparse float > >>> ing|sparse complex|sparse boxed |symbol |unicode|unicode4|?|?|verb > >>> |adverb|conjunction') >@{~ 1 2 4 8 16 32 64 128 1024 2048 4096 819 > >>> 2 16384 32768 65536 131072 262144 524288 1048576 2097152 4194304 8 > >>> 388608 i. 3!:0 > >>> > >>> (changing what needs to be changed for early interpreters). ;) > >>> > >>> So, > >>> > >>> datatype 0j1 > >>> complex > >>> datatype 'I am a literal...' > >>> literal > >>> > >>> I_am_an_unassigned_verb > >>> |value error: I_am_an_unassigned_verb > >>> |[-3] > >>> I_am_an_unassigned_verb datatype adv > >>> verb > >>> datatype datatype adv > >>> verb > >>> > >>> datatype o train <'/' > >>> adverb > >>> datatype o train <'adv' > >>> adverb > >>> > >>> datatype o train <'&' > >>> conjunction > >>> datatype o train <'bind' > >>> conjunction > >>> > >>>> works, but '' tie + will just return a fork. > >>>> '' $ ... portion of the fork in ART does not have an obvious purpose. > >>>> ART2=. (an`('' tie~ ]))@.(2097152 = 3!:0) adv NB. seems to work in > >>> examples. > >>>> regarding your comments about (`'') not a real gerund, > >>> Both remarks are related; first, allow me to clarify that (`'') > produces > >>> "real" gerunds. My actual comment was "the gerundial representation > >>> produced by (`'') technically is not an ar [atomic representation]." > An > >>> atomic representation, as its name implies, is an atom (i.e., it has > rank > >>> 0); in contrast, for a verb argument, (`'') produces a gerund having > >> rank 1 > >>> which is not an atom. That is the reason why both, > >>> > >>> (toJ f.)AR D > >>> ((10{a.) I.@(e.&(13{a.))@]} ])@:(#~ -.@((13 10{a.)&E.@,)) > >>> > >>> and > >>> > >>> (toJ f.)ART D > >>> ((10{a.) I.@(e.&(13{a.))@]} ])@:(#~ -.@((13 10{a.)&E.@,)) > >>> > >>> work (i.e., produce atomic representations confirmed by D); but, both > >>> > >>> (toJ f.)(`'') D > >>> |rank error: D > >>> | (toJ f.)(`'') D > >>> > >>> and > >>> > >>> (toJ f.)ART2 D > >>> |rank error: D > >>> | (toJ f.)ART2 D > >>> > >>> fail and report a rank error. > >>> > >>> > >>> On Mon, Aug 20, 2018 at 8:52 PM, 'Pascal Jasmin' via Programming < > >>> [email protected]> wrote: > >>> > >>>> awesome Pepe, > >>>> just some additional explanations if it helps others, (and some > >>> questions) > >>>> tie is a verb version of ` . In: > >>>> ART=. (an`('' $ '' tie~ ]))@.(2097152 = 3!:0) adv > >>>> > >>>> the left side of @. must be verbs. > >>>> (2097152 = 3!:0) is undocumented magic that detects a verb (phrase). > >> Is > >>>> there any similar magic number that would detect a string/ar > >>> representation > >>>> of modifiers? > >>>> > >>>> > >>>> - tie&'' adv > >>>> > >>>> ┌─┐ > >>>> > >>>> │-│ > >>>> > >>>> └─┘ > >>>> > >>>> works, but '' tie + will just return a fork. > >>>> '' $ ... portion of the fork in ART does not have an obvious purpose. > >>>> ART2=. (an`('' tie~ ]))@.(2097152 = 3!:0) adv NB. seems to work in > >>>> examples. > >>>> > >>>> > >>>> regarding your comments about (`'') not a real gerund, > >>>> > >>>> ({. +@- (`'')) 5!:0 NB. adds a shape. > >>>> +@- > >>>> +@- (`'') {. adv D NB. alternate of above > >>>> > >>>> > >>>> ( +@- (`'')) `:6 NB `:6 not fooled > >>>> > >>>> +@- > >>>> > >>>> > >>>> On Monday, August 20, 2018, 7:40:39 p.m. EDT, Jose Mario Quintana < > >>>> [email protected]> wrote: > >>>> > >>>> In the related thread "[Jprogramming] Applying an adverb to a > >>> list/gerund > >>>> of verbs" (see the trailing post) Pascal wrote: > >>>> > >>>>> Thank you Jose, > >>>> You are welcome Pascal (feel free to call me Pepe which is Jose's > >>>> nickname). > >>>> > >>>> > >>>>> Would you by any chance have figured out a way to make AR tacit? > >>>>> *: AR is so much easier to "call"/type than ar '*:' > >>>>> (`'') almost works, though "fails" with nouns, but is useful for an > >>>> argument that can be verb or gerund. > >>>> > >>>> I had not produced a tacit version of AR because, personally, I did > not > >>>> have the need despite the fact that I use the atomic representation > >> (ar) > >>> of > >>>> words (nouns, verbs, adverbs, and conjunctions) directly from time > to > >>>> time. (Why I do not need a tacit AR? More on that later). I will > >>> mention > >>>> some things, which I am sure you know, for the potential benefit of > >> other > >>>> members of the forum. As usual, one could always go the hard orthodox > >>> way > >>>> (in principle, at least). However, I like the easy wicked way because > >> I > >>> am > >>>> naturally lazy. > >>>> > >>>> First a word of caution, the wicked way relies on an apparent internal > >>>> design architecture feature of the J interpreters ( which treats J > >> words > >>>> the same in a fairly general sense) to perform illegal operations; > this > >>>> makes possible to produce any kind of adverb in a tacit form, > including > >>>> verb producing adverbs that refer (tacitly, of course) to the > arguments > >>> of > >>>> the verbs produced. > >>>> > >>>> I have followed the wicked way for several years using different > >> versions > >>>> of J interpreters; but, as Martin Nietzel put it recently "We are in > >>> twisty > >>>> little maze of J versions, all alike." I have noticed a slight > erosion > >>> of > >>>> the aforementioned feature in the J805 and j06 interpreters. A more > >>>> significant deterioration happened from J807 beta-e to beta-g. The > >> J804, > >>>> J805, J805 and J807 beta-e interpreters just bend and comply while > >>> running > >>>> the J Wicked Toolkit script [0]; in contrast, the J807 beta-g > >> interpreter > >>>> snaps. Likely, the wicked way will be somewhat compromised in future > >>>> official stable versions of the interpreter. Perhaps, the wicked way > >>> will > >>>> be banned altogether and no black magic will be allowed. (It is black > >>>> magic in J but it is white magic in many other programming languages > >> that > >>>> embrace higher-order functions). > >>>> > >>>> The above notwithstanding, what follows runs fine even on the J807 > >> beta-g > >>>> interpreter. > >>>> > >>>> Henceforth I am assuming that the sentences of the post below, up to > >> the > >>>> production of AR, have been run: that is, > >>>> > >>>> (9!:3) 5 2 NB. Box and linear representations... > >>>> . > >>>> . > >>>> . > >>>> AR=: 1 : '5!:1 <''u''' > >>>> > >>>> We can begin with the simple case when the argument of AR is noun, > >>>> > >>>> D=. 5!:0 NB. DoJ: Define. 5!:0 is an adverb and provides a complete > >>> inverse > >>>> of 5!:1. ( T=. i.2 3 ) 0 1 2 3 4 5 ar'T' ┌─────────┐ │┌─┬─────┐│ ││0│0 > >> 1 > >>>> 2││ ││ │3 4 5││ │└─┴─────┘│ └─────────┘ (ar'T') D 0 1 2 3 4 5 > >>>> > >>>> A tacit version of AR is, > >>>> > >>>> ART=. an f.adv T ART ┌─────────┐ │┌─┬─────┐│ ││0│0 1 2││ ││ │3 4 5││ > >>>> │└─┴─────┘│ └─────────┘ (i.2 3) ART ┌─────────┐ │┌─┬─────┐│ ││0│0 1 > 2││ > >>> ││ > >>>> │3 4 5││ │└─┴─────┘│ └─────────┘ (i.2 3) ART D 0 1 2 3 4 5 > >>>> > >>>> Of course, if the argument of ART is a verb then we will need > something > >>>> more elaborated... Actually, that is not necessarily the case! For > >>>> instance, > >>>> > >>>> +/@:*: ART > >>>> > >>>> ┌──────────┐ > >>>> > >>>> │┌─┬──────┐│ > >>>> > >>>> ││0│+/@:*:││ > >>>> > >>>> │└─┴──────┘│ > >>>> > >>>> └──────────┘ > >>>> > >>>> > >>>> is an illegal noun; yet, as far as the interpreter is concerned, it is > >> an > >>>> ar of +/@:*: > >>>> > >>>> > >>>> +/@:*: ART D > >>>> +/@:*: > >>>> ┌─────┬──┬──┐ > >>>> │┌─┬─┐│@:│*:│ > >>>> ││+│/││ │ │ > >>>> │└─┴─┘│ │ │ > >>>> └─────┴──┴──┘ > >>>> > >>>> and it can be used, as a whole, in place of the actual ar (not tested > >> it > >>>> much with the beta interpreters); for example, > >>>> > >>>> > >>>> (+/@:*: ART`:6) 1 2 3 14 > >>>> > >>>> There are instances where one might require the real thing for > internal > >>>> inspection and modification of a verb structure (for example, to > >> replace > >>>> the all its components of the form [: u v by (u@:v)). > >>>> > >>>> > >>>> In that case, the following version should work, > >>>> > >>>> tie=. (<'`') (0:`)(,^:) > >>>> > >>>> ART=. (an`('' $ '' tie~ ]))@.(2097152 = 3!:0) adv > >>>> > >>>> (use 262144 instead of 2097152 for earlier versions of the interpreter > >> if > >>>> necessary); for example, > >>>> > >>>> (i.2 3) ART > >>>> ┌─────────┐ > >>>> │┌─┬─────┐│ > >>>> ││0│0 1 2││ > >>>> ││ │3 4 5││ > >>>> │└─┴─────┘│ > >>>> └─────────┘ > >>>> > >>>> u@:v AR > >>>> ┌──────────┐ > >>>> │┌──┬─────┐│ > >>>> ││@:│┌─┬─┐││ > >>>> ││ ││u│v│││ > >>>> ││ │└─┴─┘││ > >>>> │└──┴─────┘│ > >>>> └──────────┘ > >>>> > >>>> u@:v ART D > >>>> u@:v > >>>> ┌─┬──┬─┐ > >>>> │u│@:│v│ > >>>> └─┴──┴─┘ > >>>> > >>>> (toCRLF f.ART) -: (toCRLF f.AR) > >>>> 1 > >>>> > >>>> By the way, the gerundial representation produced by (`'') technically > >> is > >>>> not an ar; for example, > >>>> > >>>> u@:v (`'') D > >>>> |rank error: D > >>>> | u@:v(`'') D > >>>> > >>>> PS. I had not produced ART before because I have access to a custom > >>>> foreign which allows to use verbs that require named words (e.g. > >> (4!:0), > >>>> (5!:1), (5!:2), etc.) namelessly. > >>>> > >>>> Reference > >>>> > >>>> [0] J Wicked Toolkit > >>>> http://www.2bestsystems.com/foundation/j/Jx.zip > >>>> \Jx\J\J Wicked Toolkit.ijs > >>>> > >>>> > >>>> > >>>> > >>>> > >>>> On Thu, Aug 16, 2018 at 11:21 PM, 'Pascal Jasmin' via Programming < > >>>> [email protected]> wrote: > >>>> > >>>>> Thank you Jose, > >>>>> Would you by any chance have figured out a way to make AR tacit? > >>>>> *: AR is so much easier to "call"/type than ar '*:' > >>>>> (`'') almost works, though "fails" with nouns, but is useful for an > >>>>> argument that can be verb or gerund. > >>>>> On Thursday, August 16, 2018, 7:48:47 p.m. EDT, Jose Mario > >> Quintana > >>> < > >>>>> [email protected]> wrote: > >>>>> > >>>>> One the one hand, I find your adverb neat and clever. On the other > >>>> hand, > >>>>> I > >>>>> like them beautiful and powerful. ;) > >>>>> > >>>>> Powerful? > >>>>> > >>>>> (9!:3) 5 2 NB. Box and linear representations... > >>>>> > >>>>> > >>>>> o=. @: > >>>>> c=. "_ > >>>>> > >>>>> ar=. 5!:1@:< > >>>>> an=. <@:((,'0') ,&:< ])f. NB. Atomizing (monadic verb) > >>>>> > >>>>> d=. (a0=. `'') (a1=. (@:[) ((<'&')`) (`:6)) (a2=. (`(<(":0);_)) > >> (`:6)) > >>>>> av=. ((ar'a0')`) (`(ar'a1')) (`(ar'a2') ) (`:6) > >>>>> NB. Adverbing a monadic verb (adv) > >>>>> assert 1 4 9 -: 1 2 3 *: av > >>>>> > >>>>> train=. (<'`:') (0:`)(,^:)&6 > >>>>> fix=. (<'f.') (0:`)(,^:) > >>>>> > >>>>> af=. an o fix f. NB. Atomizing after fixing a word (monadic verb) > >>>>> aw=. < o ((0;1;0)&{::) NB. Fetching the atomic representation > >>> (monadic > >>>>> verb) > >>>>> a3=. (o (train o aw f.)) ('av'f.) > >>>>> NB. train o aw gets the (noun or verb) argument > >>>>> > >>>>> adv=. train o ((af'c') ; ] ; (af'a3')c) f.av > >>>>> > >>>>> The motivation for producing the tacit adverb adv was to reduce > >>> directly > >>>>> the production of tacit adverbs to the production of tacit verbs, > >>>>> > >>>>> ag=. (0:`)(,^:) (<@:) (@:(train f.))("0) (train f.@:([ ; (,<,',') ; > >>>>> ])&>/@:) > >>>>> > >>>>> A=. @:] > >>>>> > >>>>> Ad=. ag adv > >>>>> > >>>>> v1`v2`v3`v4 (ar'A')Ad > >>>>> v1@:] , v2@:] , v3@:] , v4@:] > >>>>> ┌─────────┬─┬─────────────────────────────────────┐ > >>>>> │┌──┬──┬─┐│,│┌─────────┬─┬───────────────────────┐│ > >>>>> ││v1│@:│]││ ││┌──┬──┬─┐│,│┌─────────┬─┬─────────┐││ > >>>>> │└──┴──┴─┘│ │││v2│@:│]││ ││┌──┬──┬─┐│,│┌──┬──┬─┐│││ > >>>>> │ │ ││└──┴──┴─┘│ │││v3│@:│]││ ││v4│@:│]││││ > >>>>> │ │ ││ │ ││└──┴──┴─┘│ │└──┴──┴─┘│││ > >>>>> │ │ ││ │ │└─────────┴─┴─────────┘││ > >>>>> │ │ │└─────────┴─┴───────────────────────┘│ > >>>>> └─────────┴─┴─────────────────────────────────────┘ > >>>>> > >>>>> AR=: 1 : '5!:1 <''u''' > >>>>> advE =: 1 : 'AR(u`)(`:6)' > >>>>> > >>>>> AdE=. ag advE > >>>>> > >>>>> v1`v2`v3`v4 (ar'A')AdE > >>>>> v1@:] , v2@:] , v3@:] , v4@:] > >>>>> ┌─────────┬─┬─────────────────────────────────────┐ > >>>>> │┌──┬──┬─┐│,│┌─────────┬─┬───────────────────────┐│ > >>>>> ││v1│@:│]││ ││┌──┬──┬─┐│,│┌─────────┬─┬─────────┐││ > >>>>> │└──┴──┴─┘│ │││v2│@:│]││ ││┌──┬──┬─┐│,│┌──┬──┬─┐│││ > >>>>> │ │ ││└──┴──┴─┘│ │││v3│@:│]││ ││v4│@:│]││││ > >>>>> │ │ ││ │ ││└──┴──┴─┘│ │└──┴──┴─┘│││ > >>>>> │ │ ││ │ │└─────────┴─┴─────────┘││ > >>>>> │ │ │└─────────┴─┴───────────────────────┘│ > >>>>> └─────────┴─┴─────────────────────────────────────┘ > >>>>> > >>>>> (By the way, you might appreciate that both adv and advE, in this > >>>> context, > >>>>> are acting as triple (Curried) adverbs.) > >>>>> > >>>>> The end result is the same; however, one important difference is that > >>>>> (ar'A')Ad is tacit but (ar'A')Ad is not (because AR is not tacit). > >>>> Recall, > >>>>> Piet Google was asking for "a (tacit) way to apply an adverb to each > >>> of a > >>>>> list of verbs." > >>>>> > >>>>> Furthermore, adv has the implicit tacit power (provided by > >> (0:`)(,^:)) > >>> to > >>>>> perform forbidden tricks that advE cannot; adv actually applies its > >>>>> argument verb to the argument of the resulting adverb even if that > >>>> argument > >>>>> happens to be a verb; for example, > >>>>> > >>>>> *: <adv > >>>>> ┌──┐ > >>>>> │*:│ > >>>>> └──┘ > >>>>> > >>>>> boxes *:, > >>>>> > >>>>> > *: <adv 1 2 3 > >>>>> 1 4 9 > >>>>> > >>>>> In contrast, > >>>>> > >>>>> *: <advE > >>>>> < *: > >>>>> ┌─┬──┐ > >>>>> │<│*:│ > >>>>> └─┴──┘ > >>>>> > *: <advE 1 2 3 > >>>>> 0 1 1 > >>>>> > >>>>> > >>>>> On Thu, Aug 16, 2018 at 3:11 PM, 'Pascal Jasmin' via Programming < > >>>>> [email protected]> wrote: > >>>>> > >>>>>> A simpler version of your usual adv definition, that seems pretty > >>>> clean > >>>>>> (without my usual processing) > >>>>>> > >>>>>> AR=: 1 : '5!:1 <''u''' > >>>>>> adv =: 1 : 'AR(u`)(`:6)' > >>>>>> > >>>>>> > >>>>>> 1 2 3 *: adv > >>>>>> > >>>>>> 1 4 9 > >>>>>> > >>>>>> not sure if this works with all your utilities. > >>>>> > >>>> ------------------------------------------------------------ > ---------- > >>>> 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 > >> > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > > > --- > This email has been checked for viruses by AVG. > https://www.avg.com > > ---------------------------------------------------------------------- > 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
