"The literal Jenie (dJinni?) who delivers exactly what was asked for is rarely 
the hero of folklore."

So...

    t5=: 1 :(':';'2 2$(5!:5 <''u'');y;(,.x);x u/y')
   (i.5) + t5 i.4
┌─┬───────┐
│+│0 1 2 3│
├─┼───────┤
│0│0 1 2 3│
│1│1 2 3 4│
│2│2 3 4 5│
│3│3 4 5 6│
│4│4 5 6 7│
└─┴───────┘
  
   4!:0 <'t5'
1

Tie has died, and it is just a common variety of adverb.

Just in passing, I'd like to note that if we hadn't spent from 11/13/2011 to 
11/22/2011 discussing  table,  I would never have been able to untie the 
mystery. I hope you don't miss the big step forward this is for table.  You can 
now change from a  +   a  -  or  *  table without rewriting the definition! 
There are some of the old issues of spacing that linger on, but this is 
impressive. Thanks to Marshall for leading the way.

Linda

-----Original Message-----
From: programming-boun...@jsoftware.com 
[mailto:programming-boun...@jsoftware.com] On Behalf Of Edward Mokurai Cherlin
Sent: Saturday, February 18, 2012 7:20 PM
To: Programming forum
Subject: [Jprogramming] Gerunds (was Re: Verb display in function tables)

On Sat, February 18, 2012 1:10 pm, Dan Bron wrote:
> I'm not sure gerunds are defined anywhere.

Nothing precise in the J documentation. Just

"In English, a gerund is a noun that carries the force of a verb, as
does the noun cooking in the art of cooking. The tie applies to two
verbs to produce a gerund."

The best we have appears to be Bernecky, Robert, and R.K.W. Hui,
Gerunds and Representations, APL91, ACM.

Gerunds, verbal forms that can be used as nouns, are recognized as
having utility in the realm of programming languages. We show that
gerunds can be viewed as arrays of atomic representations of verbs
(functions), in a way which is consistent with the syntax and
semantics of APL, and which allows verbs to be first class objects in
the language. We define derivations of verbs from gerunds in the J
dialect of APL, and show how these derivations provide control
structures for sequencing, selection (in the sense of generalized
forms of CASE or SWITCH statements and IF/THEN/ELSE), iteration (DO
UNTIL), recursion, and parallel computation (MIMD, or Multiple
Instruction, Multiple Data). We conclude with alternative
representations of verbs which are useful in other contexts.

The basic idea is that you can create gerunds as lists of atomic
representations using tie or the unexplained

   ]h=: '+' ; '*'
+-+-+
|+|*|
+-+-+

(How did that get to be a gerund rather than a boxed list of text vectors?)

You can then use gerunds with agenda and / . So the fact that one can
have an atomic gerund, or make a table or other array from a gerund is
a sort of implementation accident. But of course, now that they exist,
we can obviously do things with them, such as selecting a row from a
gerund table for use in the usual way, or putting isolated gerundic
representations of verbs into larger boxed arrays.

> But if they were, the phrasing might be "arrays of atomic
> representations", where the "atomic representation" characteristic is the
> most salient, and "array" has the normal meaning (and perhaps the usual
> question of whether a scalar is an array?).

Just so. Compounded with the confusion between a scalar and the value
that it contains.

> We often (informally) think of gerunds as vectors, because we compose them
> with ` whose product is defined to be vector, and consume them with e.g.
> @. whose (left input) is most useful when vector.  But that's no reason to
> define gerunds as vectors, any more than to define selections as vectors,
> because we compose them with  ,  , and consume them with e.g. { whose
> (left input) is frequently vector. Or saying 'string' is a string but 's'
> is not.
>
> Of course, in some contexts, 's' is not considered a string.  So perhaps
> you are suggesting that "gerunds are are arrays of atomic representations,
> where the shape of the array has meaning"?  If so,  this is an interesting
> digression, which I'm happy to discuss, but perhaps we should move it to a
> different thread.
>
> The original question was not concerned with gerunds, and I doubt having
> the atomic representation of  f@g  (vector or scalar) in the corner of the
> result table would be satisfying. What was wanted was the string
> representation (which is produced using 5!:5, which operates on scalars,
> so shape doesn't have meaning to it, and neither does atomic
> representation).

Precisely. Thank you.

> Anyway, when present the promise of J to newcomers, we need to take care
> not obscure the pitfalls.  The literal Jenie (dJinni?) who delivers
> exactly what was asked for is rarely the hero of folklore.
>
> -Dan
>
> PS:  If we wish to continue the digression, it might be better to start
> with the links below,  better starting point would be wh
>
>  Here's a couple places where I've attempted to capture the meaning of
> "gerund"
>
> Sidebar in NuVoc definition of ` :
> http://jsoftware.com/jwiki/Vocabulary/backtick#sidebar.3Agerunds
>
> As a necessary premise in the definition of a modifier utility:
> www.jsoftware.com/jwiki/DanBron/Snippets/DOOG#definition
>
> Please excuse typos; composed on a handheld device.
>
> -----Original Message-----
> From: Raul Miller <rauldmil...@gmail.com>
> Sender: programming-boun...@jsoftware.com
> Date: Sat, 18 Feb 2012 11:52:13
> To: Programming forum<programming@jsoftware.com>
> Reply-To: Programming forum <programming@jsoftware.com>
> Subject: Re: [Jprogramming] Verb display in function tables
>
> Ok...
>
> ...except that gerunds are defined as vectors.
>
> Conceptually speaking, if it's a scalar, or a matrix, it's something
> different.  It would still be gerund-like, in character (we can
> trivially extract gerunds from it), but if we try using such things
> with primitives that handle gerunds, we are getting into undocumented
> territory.
>
> --
> Raul
>
> On Sat, Feb 18, 2012 at 11:18 AM, Dan Bron <j...@bron.us> wrote:
>> That makes sense.
>>
>> My personal impression was that the original vector-ness was an
>> (unintentional) side-effect of the method used to remove the trailing
>> atom (select-all-but-last as opposed to select-first).
>>
>> The proposed scalar should be a transparent replacement for the original
>> vector, whose shape wasn't serving a specific purpose (normally, in J,
>> shape carries meaning, and where it doesn't it is misleading: at best
>> superfluous, but often pernicious).
>>
>> Â -Dan
>>
>>
>> Please excuse typos; composed on a handheld device.
>>
>> -----Original Message-----
>> From: Raul Miller <rauldmil...@gmail.com>
>> Sender: programming-boun...@jsoftware.com
>> Date: Sat, 18 Feb 2012 10:41:56
>> To: Programming forum<programming@jsoftware.com>
>> Reply-To: Programming forum <programming@jsoftware.com>
>> Subject: Re: [Jprogramming] Verb display in function tables
>>
>> I often do that myself, but in this case, the original phrase was also
>> generating a 1 element vector, so I decided that a 1-element vector
>> was an appropriate result.
>>
>> --
>> Raul
>>
>> On Sat, Feb 18, 2012 at 9:48 AM, Dan Bron <j...@bron.us> wrote:
>>> Because in many contexts, a scalar is more convenient than a 1-element
>>> vector, I make a habit of tacking on a   {.  as in   {.u`''  .
>>>
>>> -Dan
>>>
>>>
>>> On Feb 18, 2012, at 9:32 AM, Raul Miller <rauldmil...@gmail.com> wrote:
>>>
>>>> I would use u`''
>>>>
>>>> Â  avg 1 :'u`'''''
>>>> +---+
>>>> |avg|
>>>> +---+
>>>> Â  avg
>>>> |value error: avg
>>>>
>>>> --
>>>> Raul
>>>>
>>>>
>>>> On Fri, Feb 17, 2012 at 1:57 PM, Edward Mokurai Cherlin
>>>> <moku...@sugarlabs.org> wrote:
>>>>> I had thought that I would not be able to get a program to show the
>>>>> definition of a function given its name, but I found a kludge for the
>>>>> purpose using tie. Now I would like to know whether somebody has a
>>>>> direct solution. My application for this capability is a defined
>>>>> adverb for producing function tables.
>>>>>
>>>>> Â  t=.1 :(':';'2 2$(>1 0#u`u);y;(,.x);x u/ y')
>>>>> Â  l +t l=.i.5
>>>>> ┌─┬─────────┐
>>>>> │+│0 1 2 3 4│
>>>>> ├─┼─────────┤
>>>>> │0│0 1 2 3 4│
>>>>> │1│1 2 3 4 5│
>>>>> │2│2 3 4 5 6│
>>>>> │3│3 4 5 6 7│
>>>>> │4│4 5 6 7 8│
>>>>> └─┴─────────┘
>>>>>
>>>>> The question then is whether somebody knows a less ugly way to
>>>>> display
>>>>> the value of u in executing this adverb than >1 0#u`u or >0{u`u .
>>>>>
>>>>> --
>>>>> Edward Mokurai [UTF-8 damage] Cherlin

-- 
Edward Mokurai (默雷/धर्ममेघशब्दगर्ज/دھرممیگھشبدگر ج) Cherlin
Silent Thunder is my name, and Children are my nation.
The Cosmos is my dwelling place, the Truth my destination.
http://wiki.sugarlabs.org/go/Replacing_Textbooks
----------------------------------------------------------------------
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