Of course -- we have merely been discussing the meta issue of notations
that characterize this distinction.

-- 
Raul

On Tuesday, February 7, 2012, Don Guinn <[email protected]> wrote:
> Couldn't a scalar be considered an array with rank of zero?
>
> On Tue, Feb 7, 2012 at 2:53 PM, Raul Miller <[email protected]> wrote:
>
>> [comments inline, because otherwise I become lost]
>>
>> On Tue, Feb 7, 2012 at 3:43 PM, Viktor Cerovski
>> <[email protected]> wrote:
>> > Raul Miller-4 wrote:
>> >>> Here is where ADT show some power in reasoning about data,
>> >>> because we can ask what does it mean for instance, "everything
>> >>> is array".  Well, as I wrote some time ago, to me in J scalars are
>> >>> not arrays because the equation
>> >>>  a-:a,x
>> >>> has no solution for any scalar a, but has solution for an array a.
>> >>> So, ADT could be helpful in sorting this type of questions with
>> >>> some rigour.
>> >>
>> >> But why is the ',' operation the determining issue, here?  Is your
>> >> reasoning based on the existence of the ',' verb?
>> >
>> > Indeed. But this existence is not accidental---pretty much every
>> > programming language has some sort of append, concatenate, etc.
>> > It's as far as J primitives go, pretty primitive operation, also
>> > frequently used.
>>
>> Agreed -- it's a simple operation which is useful fairly wide variety
>> of contexts.
>>
>> > Furthermore, I'd like to put "everything is array" to the test: are
>> > scalars arrays?  Is there any way to decide or test it or is it a mere
>> > conventional saying?
>>
>> It's clear to me that everything is not an array.
>>
>> For example: verbs, such as the operation denoted by (,) are not
>> arrays (though they may represented as arrays and their arguments and
>> results are arrays).
>>
>> > Then I said scalars are not arrays because I don't have a noun in J
>> > that I can append to a scalar and get that same scalar, but I have
>> > such nouns in the case of arrays.  Sounds somewhat arbitrary?  I'll
>> > come back to this question from the perspective of ADT.
>>
>> Indeed, it sounds arbitrary.  In part because "append" is arbitrary.
>> I (and have) constructed programs that use arrays which do not use
>> append.  Why should append be relevant to those programs?
>>
>> > First, the way you circumvent the problem:
>> >
>> >> If so, let's say I defined:
>> >>
>> >> viktor=:4 :0
>> >>   R=. x,y
>> >>   if. (1-:#R) *. 0 e. x ,&(#@$) y do. {.R end.
>> >> )
>> >>
>> >> ..and let's say that I use this 'viktor' operation in place of ',' --
>> >> has the definition of "Array" changed?
>> >
>> > Array hasn't changed, but append *has* changed to accommodate
>> > the exception.
>>
>> No, append has not changed.  Not unless we define append as something
>> like "whatever operation we happen to be considering".  The existence
>> of (viktor) does not replace the existence of (,).
>>
>> >  Equivalently,
>> >
>> >   p =: *.&(''&-:) $@]
>> >   append =: ,`[@.(p~)`]@.p
>>
>>    3 (append -: viktor) i. i. 3
>> 0
>>
>> > (x p y is the predicate: is x scalar and y empty array?)
>> >
>> >> Is your argument that , is a language primitive where 'viktor' is not
>> >> a language primitive?  If so, does that mean that
>> >>
>> >>    i.2 2
>> >> 0 1
>> >> 2 3
>> >>
>> >> is not a matrix, because +/ .* is not a primitive?
>> >
>> > I think that if , were defined as you suggest or in a similar way
>> > we would have had somewhat better definition of append, more
>> > attuned to the 'everything is array' statement.
>>
>> But why?
>>
>> We can have all three definitions -- the language allows us to do that.
>>
>> > ADT let us see better where is the problem.
>> > I begin with the following definition of the type of integer J arrays
as:
>> >
>> > Jarr = [int]*[int]
>> >
>> > The first list is the rank, the second elements.  Clearly, scalars fit
>> into
>> > this type---number 5 would be represented as []*[5], number 2>
----------------------------------------------------------------------
>> 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

Reply via email to