On Oct 20, 2011, at 8:24 PM, Roger Hui wrote:

> You have to use a different word than "noun".  It's already taken and
> it means "array".

Roger,

I have to agree with Rich.

With all due respect (and that is not a trite phrase -- I really _do_ respect 
the tremendous work and thought that you have put into APL and J), it seems 
incorrect to me to say that the word "noun" means "array". 

The object on which verbs operate, that is, a noun, can be either an array, or 
a scalar.

The J Primer says that 

> In the following sentence the numbers 2 and 5 are both nouns.
> 
>    2 + 5

In the example, both 2 and 5 are scalars.   So, a noun, by definition, is at 
least a scalar.

But, from other examples, we know that a noun can also be an array.

So a noun is either a scalar or an array.  

This can be demonstrated in J itself:

>    f =: 3 : 0
> (('Rank';$$y),:('Shape';$y)),'Tally';#y
> )
>    f ''   NB. strings are arrays, even empty strings
> ┌─────┬─┐
> │Rank │1│
> ├─────┼─┤
> │Shape│0│
> ├─────┼─┤
> │Tally│0│
> └─────┴─┘
>    f 1     NB. pass a scalar (no rank)
> ┌─────┬─┐
> │Rank │0│
> ├─────┼─┤
> │Shape│ │
> ├─────┼─┤
> │Tally│1│
> └─────┴─┘
>    f ,1    NB. pass an array of one scalar
> ┌─────┬─┐
> │Rank │1│
> ├─────┼─┤
> │Shape│1│
> ├─────┼─┤
> │Tally│1│
> └─────┴─┘
>    f 1 2   NB. pass an array of two scalars
> ┌─────┬─┐
> │Rank │1│
> ├─────┼─┤
> │Shape│2│
> ├─────┼─┤
> │Tally│2│
> └─────┴─┘
>    f 0$1   NB. pass an empty array (zero shape)
> ┌─────┬─┐
> │Rank │1│
> ├─────┼─┤
> │Shape│0│
> ├─────┼─┤
> │Tally│0│
> └─────┴─┘
>    f ''$1  NB. pass a null rank object (scalar)
> ┌─────┬─┐
> │Rank │0│
> ├─────┼─┤
> │Shape│ │
> ├─────┼─┤
> │Tally│1│
> └─────┴─┘

Alan


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to