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



On Thu, Oct 20, 2011 at 7:54 PM, Henry Rich <[email protected]> wrote:
> My quibble is simply with the definition.  I think it's great that all
> nouns follow the rules they do.  I just wish I had a word that meant
> 'non-atomic array' (in my classes, I use 'array' to mean that).  I say
> 'noun' to mean 'scalar or array'.
>
> I think the usual meaning of 'array' is an arrangement of things.  A
> scalar - an a-tom, that which cannot be divided - is not 'arranged', it
> just is.  It should be called a noun, not an array.  The rules for
> handling nouns are cleverly designed so that they move seamlessly from
> arrays to atoms.
>
> And just now reading Roger's post, it seems to me to make my point: I
> would say "a monadic function takes a noun as argument and returns a
> noun result".  I see an improvement in brevity and expressiveness.
>
> Henry Rich
>
> On 10/20/2011 10:34 PM, Marshall Lochbaum wrote:
>> While that is an important property, your argument is a lot like saying that
>> an empty list cannot be counted as a list because all other lists have a
>> first element. Admittedly, scalars are very different from other arrays, but
>> it's essential that we still be able to consider them as arrays because
>> otherwise we are forced to concern ourselves with the number of dimensions
>> in an array--for instance, scalar and vector addition become very different
>> operations.
>>
>> One of the really cool properties of J is that it eliminates a lot of
>> distinctions: I can write code that works for lists of numbers or lists of
>> arrays, and I never care about the number of dimensions in an array. Adding
>> a distinction like scalar/array back runs counter to this process.
>>
>> Marshall
>>
>> On Thu, Oct 20, 2011 at 10:09 PM, Viktor Cerovski<[email protected]
>>> wrote:
>>
>>>
>>> Not so long post with a proof that in J scalars are different from arrays.
>>>
>>> Björn Helgason wrote:
>>>>
>>>> You asked about "hermeneutical horizon" so I did decide on the religious
>>>> aspect of the question.
>>>>
>>> I don't think we need just yet any of religious aspects here
>>> since there is a nice mathematical explanation:
>>>
>>>   There is a monoidal zero wrt Append (,) for any array
>>>   except when its shape is 0$0.
>>>
>>> It's that simple.  Here is the proof:
>>>
>>> The following monadic verb:
>>>    mzero =: 0 $~ 0 , }.@$
>>>
>>> returns monoidal zero for any array of nonempty shape.
>>> This means that the following expression returns 1 for
>>> any non 0$0 shaped noun x:
>>>
>>>    ((, mzero) -: ])x
>>>
>>> or, in other words,
>>>
>>>    x -: x, mzero x
>>>
>>> returns 1.  For example (the following is a pasted J session):
>>>
>>>    mzero =: 0$~0,}.@$
>>>    ((, mzero) -: ]) 1$1
>>> 1
>>>    ((, mzero) -: ]) 0$1
>>> 1
>>>    ((, mzero) -: ]) 0 0 0 3 5$1 2 3
>>> 1
>>>    ((, mzero) -: ]) i.7 5 4
>>> 1
>>>    ((, mzero) -: ]) 123
>>> 0
>>>
>>> In the case when x has shape 0$0, however, there is no
>>> noun mz in J such that
>>>
>>>    x -: x,mz
>>>
>>> returns 1.  For example, eq.:
>>>
>>>    1 -: 1,mz
>>>
>>> has no solution in J.  The same holds for the eq:
>>>
>>>    'a' -: 'a',mz1
>>>
>>> In particular, the "obvious" solution for mz1 doesn't work:
>>>
>>>    'a' -: 'a' , ''
>>> 0
>>>
>>> Btw, monoid for which mzero gives the (right) zero is the set of all
>>> J arrays whose *items* have the same shape, in which case
>>> it is also the left zero, together with dyadic Append (,).  That is
>>> straightforward to prove since the only somewhat tricky part
>>> was getting the zero.
>>>
>>> Scalars are then indeed mathematically different than arrays
>>> in J, which justifies calling them numbers/chars rather than
>>> arrays of numbers/chars.
>>>
>>>
>>>
>>>> 2011/10/20 Viktor Cerovski<[email protected]>
>>>>
>>>>>
>>>>> It's a bit longer post, but it demonstrates that numbers are
>>>>> not arrays in J.
>>>>>
>>>>>
>>>>> Björn Helgason wrote:
>>>>>>
>>>>>> It depends on what it is
>>>>>> 123 can be a number
>>>>>> 123 can be text
>>>>>> You can change it from text to number and other way around.
>>>>>>
>>>>>> So 123 can be or become what you want it to be.
>>>>>>
>>>>> I was talking about 123 as defined in J,  where
>>>>> 123-as-text would be written '123'.
>>>>>
>>>>> Henry points out that any number can be interpreted as an
>>>>> array with an empty shape.  Then, there is also an interpretation
>>>>> that an array with an empty shape can be considered a scalar.
>>>>> So, in this above case this scalar is 123, so why not call, interpret,
>>>>> think of it as of a number?
>>>>>
>>>>>
>>>>>> What you believe it to be may not be what it really is.
>>>>>> You have to test it and make sure it is the shape and character you
>>>>>> believe
>>>>>> in or not.
>>>>>> After you find out what 123 is you can decide on what you want to do.
>>>>>> To take 123 on in blind faith can prove to be a mistake and can cause
>>>>>> problems and failures.
>>>>>>
>>>>> If by this you mean whether I believe that the printed representation
>>>>> 123 of some noun tells us what the rank of the noun is, then of course
>>>>> I don't believe this.  For instance, if J session looks like:
>>>>>
>>>>>     f x
>>>>> 123
>>>>>
>>>>> then I don't know whether the resulting 123 has rank 0 or 1,
>>>>> but that's just how J prints nouns, and we can test the result
>>>>> further to sort this out, as you also suggest.
>>>>>
>>>>> So I did some testing on whether it can be distinguished in J between
>>>>> 123-as-number or 123-as-an-array.   Basically, the issue cannot
>>>>> be resolved simply by a single test: imagine that we call
>>>>> all rank zero nouns that are numbers just, well, numbers.
>>>>>
>>>>> Let's instead look how the two concepts of 123 fit into the language.
>>>>>
>>>>> It indeed looks like 123 is an array: it has (empty) shape, rank 0,
>>>>> and it has one element:
>>>>>
>>>>>    e=:0$0  NB. empty array
>>>>>
>>>>>    e -: $123
>>>>> 1
>>>>>    #123
>>>>> 1
>>>>>    0{123
>>>>> 123
>>>>>    1{123
>>>>> |index error
>>>>> |   1    {123
>>>>>
>>>>> We get the index error because there is no second element of
>>>>> 123-as-array.  So far so good.  But how do we then explain
>>>>> the following:
>>>>>
>>>>>    }.123
>>>>>
>>>>>    e -: }.123
>>>>> 1
>>>>>
>>>>>    123 -: 123,e
>>>>> 0
>>>>>
>>>>> The problem with this can be stated in English as:
>>>>> In J, when we drop the leading element of 123 we get
>>>>> empty array, but when we append empty array to 123 we
>>>>> don't get 123.
>>>>>
>>>>> Let us just say: that is how things are defined, a bit strange
>>>>> as they might be.  But then again, when 123 is a one
>>>>> element array, I get the desired property *of arrays*:
>>>>>
>>>>>    (1$123) -: 123,e
>>>>> 1
>>>>>    (1$123) -: 123,e,e
>>>>> 1
>>>>>    (1$123) -: 123,e,e,e,e,e,e,e
>>>>> 1
>>>>>    (1$123) -: e,e,e,123,e,e,e,e
>>>>> 1
>>>>>
>>>>> (In English: appending/prepending an empty array to
>>>>> an array does not change it.)
>>>>>
>>>>> So from this follows the conclusion that 123 is not an array,
>>>>> while 1$123 is.
>>>>>
>>>>> It is not anymore the matter of interpretation of 123,
>>>>> but the structural/language issue with J, namely
>>>>> that numbers are not arrays, unless, that is, we drop the
>>>>> requirement that appending empty array doesn't do
>>>>> anything to an array.
>>>>>
>>>>>
>>>>> 2011/10/20 Viktor Cerovski<[email protected]>
>>>>>
>>>>>>
>>>>>>
>>>>>> Raul Miller-4 wrote:
>>>>>>>
>>>>>>> On Thu, Oct 20, 2011 at 9:43 AM, Viktor Cerovski
>>>>>>> <[email protected]>  wrote:
>>>>>>>> Henry Rich wrote:
>>>>>>>>>
>>>>>>>>> Point of nomenclature: every noun has a shape.  All shapes are
>>>>> lists.
>>>>>>>>> The shape of an atom is an empty list.
>>>>>>>>>
>>>>>>>>> (also, all nouns are arrays, ecch)
>>>>>>>>>
>>>>>>>> Statements like "all nouns are arrays" is hard to make precise
>>>>>>>> due to the dynamic typing of J.
>>>>>>>
>>>>>>> An array is a region of computer memory whose interpretation (and,
>>> if
>>>>>>> we exclude things like sparse arrays, its size) is determined by its
>>>>>>> shape and its type.
>>>>>>>
>>>>>>> A shape is a list of non-negative integers whose product is the
>>>>> number
>>>>>>> of elements in an array.
>>>>>>>
>>>>>>> To make this precise you have to enumerate those types...
>>>>>>>
>>>>>> Given all these conditions and definitions (a big given!),
>>>>>> what is then hermeneutical horizon of 123 in J:
>>>>>>
>>>>>> Should I interpret it as a number, or an array, or both,
>>>>>> or neither?
>>>>>> --
>>>>>> View this message in context:
>>>>>>
>>>>>
>>> http://old.nabble.com/%7B.-y-produces-an-array.-tp32687373s24193p32690306.html
>>>>>> Sent from the J Programming mailing list archive at Nabble.com.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to