Re: [stack] array theory question
John Cowan <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <[email protected]> |
John Nowak scripsit:
> My question is this: Am I correct in thinking that single element
> arrays in Nial (and I believe also APL2) are equivalent to their
> contents? In other words, does {42} == 42? Also, does anyone know
> anything about the history of this question as it pertains to APL?
> Thanks in advance.
The answer to the question, as posed, is "No". But a better question
is this: "Is a scalar an array"? And the answer to that is "Yes, a
scalar is an array of rank 0, which by definition contains 1 element."
This is true AFAIK in all APL-derived languages. A single-element array
can be of any rank.
Backing off to your underlying issue, there is no problem with either
identifying tuples of size 1 with scalars in languages that have tuples,
or not doing so. ML, Haskell, and Pure do: Python and Q don't.
--
Work hard, John Cowan
play hard, [email protected]
die young, http://www.ccil.org/~cowan
rot quickly.