some practical issues for this, I have not measured the performance benefit.
sure foreigns to convert to/from gerund-boxed entity. but from jx, `. could be used to make "boxed entities" I used boxed entities instead of boxed verbs because of modifiers. Note the issues/differences between ar and aar below ar =: 1 : '5!:1 <''u''' eval =: 1 : 'if. 2 ~: 3!:0 m do. m else. a: 1 : m end.' isNoun =: (0 = 4!:0 ::0:)@:< aar =: 1 : 'if. isNoun ''u'' do. q =. m eval else. q =. u end. 5!:1 < ''q'' ' '/' ar NB. ar of an ordinary string ┌─────┐ │┌─┬─┐│ ││0│/││ │└─┴─┘│ └─────┘ '/' aar NB. actual ar of an adverb ┌─┐ │/│ └─┘ a =. / 'a' ar NB. noun not name ┌─────┐ │┌─┬─┐│ ││0│a││ │└─┴─┘│ └─────┘ 'a' aar NB. named ar ┌─┐ │a│ └─┘ 'azxczxc' aar NB. ar of name that doesn't/may not exist [1] ┌───────┐ │azxczxc│ └───────┘ b =. 3 'b' aar NB. or b aar (names that are nouns get "early bound") [2] ┌─────┐ │┌─┬─┐│ ││0│3││ │└─┴─┘│ └─────┘ b ar ┌─────┐ │┌─┬─┐│ ││0│3││ │└─┴─┘│ └─────┘ [1] and [2] are sensible behaviour, but [2] is the least sensible of these. aar would be simpler and more consistent if it always treated strings as either raw modifiers or "late bound" names. (a change I will make in my definition soon). An early bound noun or verb can be captured by not quoting it. My version of Jx's `. is a conjunction named tie. I also use a conjunction named tieA to get aar behaviour instead of ar behaviour. There may be need for tieAF which would fix a definition of a term (so early bind it) One advantage of boxed entities that is not performance related is that they are shorter and more readable. (look like lrs) To distinguish between nouns and modifiers/names, string nouns would be "double" quoted. suggested primitives `. - ar based. `.. - aar based. `... - fixed aar ________________________________ From: Jose Mario Quintana <jose.mario.quint...@gmail.com> To: Programming forum <programm...@jsoftware.com> Sent: Sunday, August 6, 2017 5:23 PM Subject: Re: [Jprogramming] Boxed verbs as alternate gerunds I am not hoping to change people's minds; nevertheless, I would like to explain, to some degree, my rationale regarding my current notion of what a gerund is. The Dictionary is famous (or infamous according to some?) for its terseness. It is not really surprising to me that different people have different understandings even regarding the very important concept of gerund. Personally, I use Dictionary as the primary source but complemented by other official documents, forum information (particularly opinions and statements from certain people), third party sources, and first and foremost the "real thing", the interpreter(s) which it is, after all, where programs and utilities for writing programs, some of which are very important to me, run. Let me start with the (current version of the) Dictionary, this is how I perceive it, given its terseness, the statement "Verbs act upon nouns to produce noun results..." is generally interpreted as "Verbs act upon nouns [and only nouns] to produce noun [and only noun] results..." and other supporting evidence clearly confirm that is the intention. Therefore, assuming that the Dictionary is consistent, then the statement related to the to the entry Tie (Gerund), " More generally, tie produces gerunds as follows: u`v is au,av , where au and av are the (boxed noun) atomic representations (5!:1) of u and v . Moreover, m`n is m,n and m`v is m,av and u`n is au,n . See Bernecky and Hui [12]. Gerunds may also be produced directly by boxing. " could be intrepreted as "... tie produces gerunds [and only gerunds]..." (I know that, actually , tie can produce also nouns which are not gerunds; just as a verbs can produce words which are not a nouns.) Incidentally, I do not regard foreings as part of the core language either but they are in the Dictionary, and they are used to illustrate points, even when discussing a primitive (see (5!:1) above). Furthermore, "Moreover, m`n is m,n and m`v is m,av and u`n is au,n" suggests that both, the left and right arguments do not have to be verbs. Indeed, the gerund (produced by) +`-`* is equivalent to (+`-)`* and (+`-) is not a verb it is a gerund (i.e, a noun). The last sentence "Gerunds may also be produced directly by boxing" is quite important in the context of last part of that page, " The atomic representation of a noun (used so as to distinguish a noun such as '+' from the verb +) is given by the following function: (ar=: [: < (,'0')"_ ; ]) '+' +-----+ |+-+-+| ||0|+|| |+-+-+| +-----+ *`(ar '+') +-+-----+ |*|+-+-+| | ||0|+|| | |+-+-+| +-+-----+ " There, clearly, the right argument (ar '+') of ` is the atomic representation of a noun ('+') not a verb. That is, *`(ar '+') is a gerund and, for example, G=. (*:`ar 0 1 2) is a gerund well. Let me jump to the Dictionary's entry for Evoke Gerund (`:), " m `: 6 Train Result is the train of individual verbs. " Right, it is referring to a train of verbs but the entry is Evoke Gerund and G (defined above) is a gerund which makes sense (to me) as a train; so I expect G`:6 to work, and it does, G`:6 0 1 4 Let me jump to the Dictionary's entry for Agenda (@.), " m@.n is a verb defined by the gerund m with an agenda specified by n ; that is, the verb represented by the train selected from m by the indices n . If n is boxed, the train is parenthesized accordingly. The case m@.v uses the result of the verb v to perform the selection. " Again, verbs are mentioned; yet again, I expect G@.0 1 to work, and it does, G@.0 1 0 1 4 Incidentally, if is not for producing code (and executing code), what is the purpose of "If n is boxed, the train is parenthesized accordingly. The case m@.v uses the result of the verb v to perform the selection" (see above)? What did the original co-designer and implementor of the language write, in the post I mentioned before, responding to the question, how to test for a gerund? Here it is, " [Jprogramming] how to test for a gerund Roger Hui gerundYN=: 0 -. at e. 3 : ('y (5!:0)';'1')"0 :: 0: gerundYN +`* 1 gerundYN <'0';i.5 1 gerundYN <i.5 0 gerundYN 5!:1 <'gerundYN' 1 See also http://www.jsoftware.com/help/dictionary/dx005.htm#1 " He used a foreign (5!:0) to write his testing verb, he "produced directly by boxing" a gerund and tested it ( gerundYN <'0';i.5 ), and he used a foreign to produce a gerund and tested it ( gerundYN 5!:1 <'gerundYN' ). I could keep going but all the above is enough for me to justify my opinion that a gerund is not merely a list of atomic representations of verbs. Ultimately, it does not matter what name (gerund, gerundive, etc.), if any, is given to these entities; different people at different times have used these AND related entities in the context of `:6 , and @. . I, for one, would not be a happy camper if the official interpreter is changed in such a way that my programs and utilities for writing programs break down, even if I have an alternative. Finally, I would like to pose a simple yet subtle question to those who do not regard a gerund as merely a list of of atomic representations of verbs, erase'v' 1 gerundYN 'v' NB. Roger's test... 1 isgerund =: 0:`(0 -. @ e. 3 : ('y (5!:0)';'1')"0)@.(0 < L.) :: 0: isgerund 'v' NB. Pascal's test 0 Is 'v' a gerund or not? On Thu, Aug 3, 2017 at 7:31 PM, Bill <bbill....@gmail.com> wrote: > From my understanding, the reference shows the atomic representation of > gerund. It does not advocate this a way to construct a gerund. moreover it > is "foreign" conjunction. > > numbers can be converted from strings using foreign conjunction but it > doesn't mean J encourages writing numbers using this method. > > IMO foreign conjunction is not a part of J core. > > > Sent from my iPhone > > On 4 Aug, 2017, at 5:33 AM, Jose Mario Quintana < > jose.mario.quint...@gmail.com> wrote: > > > " > > In J dictionary, only tie conjunction > > on verbs was mentioned to produce a gerund. > > " > > > > I am afraid you might not be the only one who has reached such > conclusion. > > Nevertheless, in my opinion, it is a misconception that a gerund can only > > be a list (of atomic representations) of verbs. Why? See [0] in the > > context of [1]. > > > > [0] Atomic > > http://www.jsoftware.com/help/dictionary/dx005.htm#1 > > > > [1] [Jprogramming] how to test for a gerund Roger Hui > > http://www.jsoftware.com/pipermail/programming/2010-April/019178.html > > > > Mind you gerundYN is not bulletproof. > > > > > > On Thu, Aug 3, 2017 at 5:46 AM, bill lam <bbill....@gmail.com> wrote: > > > >> I am thinking of the opposite. In J dictionary, only tie conjunction > >> on verbs was mentioned to produce a gerund. Boxed verbs had not been > >> mentioned. Atomic representation of boxed verbs looks like that of > >> gerund and therefore can work as gerund. IMO this is a backdoor > >> provided by J implementation. > >> > >> Metadata could be attached to "real" gerunds that have ancestors which > >> were results of verb`verb. All other nouns without this DNA would be > >> regarded as non-gerund. > >> > >> Just my 2 cents. > >> > >> On Thu, Aug 3, 2017 at 3:57 PM, Marshall Lochbaum <mwlochb...@gmail.com > > > >> wrote: > >>> Can I just point out that it's not too late to add some (documented) > way > >>> to box verbs/adverbs/conjunctions? These could be treated as gerunds by > >>> everything that currently uses gerunds, and the interpreter can just > >>> throw an error if anything attempts to actually unbox them. They are > >>> much harder to confuse than the current gerunds, and will have far > >>> better performance. > >>> > >>> This sounds like a radical divergence from the way J works now, but I > >>> don't think it is in practice. Programmers would use some new > >>> conjunction to replace (`), and provided they don't inspect the > >>> structure of gerunds nothing else changes. I suppose there would need > to > >>> be a way to check what class of object a box contains, because unboxing > >>> to check the type is not allowed. Gerunds would remain useful for > >>> programmers who want to inspect functions or build them from scratch, > >>> but would otherwise become obselete. > >>> > >>> Marshall > > ---------------------------------------------------------------------- > > 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