[Jprogramming] Boxed verbs as alternate gerunds
Erling Hellenäs
erling at erlinghellenas.se
Mon Aug 7 11:04:20 UTC 2017
Hi all !
Maybe we need a nounification operation? An operation that creates a
noun from a verb? We could then create arrays of these nounified verbs?
To execute them we would then need a verbification operation? Nounify
and verbify? Possibly, in Jx, there could be a need to in equivalent
ways nounify adverbs and conjunctions? We would then need adverbify and
conjunctionalize operations? Possibly verbify, adverbify and
conjunctionalize could be the same primitive? It could then be called
functionalize?
The nounified functions could be stored in memory in their compiled
form? As single verbs, adverbs and conjunctions?
This would allow J to handle functions as data?
In a functional language like F#, functions are data until you execute
them. You could have arrays of functions with the same signature. There
are box and unbox operations to access all contents in arrays. Sometimes
these are implicit, they are for example built into the indexing
operation. If you wanted to have arrays of functions with different
signatures, you would have to use something called discriminated unions.
Type information stored with the data. Different handling for different
types.
In JWithATwist I could include additional types in the nouns, monadic
verbs and dyadic verbs for example. I could then handle these in
compiled form, with implicit pointers to the compiled .NET functions. I
could not easily mix monadic and dyadic verbs in the same array because
the type information is stored with the array, not in each cell. To
create arrays of both monadic and dyadic verbs I would probably use
boxed arrays.
Cheers,
Erling Hellenäs
On 2017-08-07 02:34, Bill wrote:
> I am not sure if I understand your question. If you asked something undefined is a gerund or not. I checked by executing v at .0 '' and the J interpreter said value error. Sounds like an empty array joke to me.
>
> Sent from my iPhone
>
> On 7 Aug, 2017, at 5:23 AM, Jose Mario Quintana <jose.mario.quintana at gmail.com> wrote:
>
>> 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 at .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 at .v uses the
>> result of the verb v to perform the selection.
>> "
>>
>> Again, verbs are mentioned; yet again, I expect G at .0 1 to work, and it does,
>>
>> G at .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 at .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.lam at 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.quintana at 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.lam at 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 <mwlochbaum at 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
More information about the Programming
mailing list