empty intervals Per Bothner (29 Jul 2015 16:44 UTC)
Re: empty intervals John Cowan (29 Jul 2015 17:12 UTC)
Re: empty intervals John Cowan (29 Jul 2015 17:16 UTC)
Re: empty intervals Bradley Lucier (29 Jul 2015 20:21 UTC)
Re: empty intervals Per Bothner (29 Jul 2015 20:56 UTC)
Re: empty intervals Bradley Lucier (29 Jul 2015 22:02 UTC)
Re: empty intervals Per Bothner (29 Jul 2015 23:36 UTC)
Re: empty intervals John Cowan (01 Aug 2015 03:52 UTC)
Re: empty intervals Bradley Lucier (01 Aug 2015 03:57 UTC)
Re: empty intervals Bradley Lucier (31 Jul 2015 20:49 UTC)
Re: empty intervals Per Bothner (31 Jul 2015 22:14 UTC)
Re: empty intervals John Cowan (31 Jul 2015 23:57 UTC)
Re: empty intervals John Cowan (31 Jul 2015 23:37 UTC)
Re: empty intervals Bradley Lucier (01 Aug 2015 02:00 UTC)
Re: empty intervals John Cowan (29 Jul 2015 21:11 UTC)
Re: empty intervals Bradley Lucier (29 Jul 2015 22:27 UTC)
Re: empty intervals John Cowan (01 Aug 2015 04:20 UTC)

Re: empty intervals Bradley Lucier 29 Jul 2015 22:26 UTC

> On Jul 29, 2015, at 5:07 PM, John Cowan <xxxxxx@mercury.ccil.org> wrote:
>
> Bradley Lucier scripsit:
>
>> Is an empty set of one-indices "the same” (in whatever sense) as an
>> empty set of two-indices?  (In set theory, yes.  In some other theories,
>> I don’t know.)
>
> I think that thinking of arrays or even array indices as sets is a mistake.

Why should we not think of array indices as belonging to a set?

> So these would be distinct: a vector (in the math, not the Scheme, sense)
> is not a matrix.

True, but a (math) matrix is a (math) vector.  I’m not getting the relevance of this statement.  Neither math vectors nor math matrices are arrays (or vice versa).

>
>> Perhaps if I understood the use of such things.  We already have
>> scalars, why do we need zero-dimensional arrays?
>
> For one thing, a zero-dimensional array is a box, a mutable container for
> a value, not just a value.

It can be interpreted as a box, yes, but most schemes already have boxes.

>  For another, because Scheme does not normally
> have polymorphic procedures, we can treat arrays and scalars uniformly if
> zero-dimensional arrays are taken to be scalars.

Can you give me an example?

>  In addition, Matlab,
> NumPy, CL, and Julia all allow zero-dimensional arrays and treat them
> identically, which is good precedent.  I don't claim to be a scientific
> programmer, but doing what scientific programming languages do seems to
> me to be the Right Thing.

I think the "scheme way" is to do "the right thing” (see continuations, hygienic macros, …), but that doesn’t mean following other languages for its own sake.

I don’t know NumPy or Julia. Matlab has transformed computational science and engineering, and I have been following it from the first versions that Cleve Moler wrote while still an academic in the '70s.  There are many things that Matlab does in the name of usefulness that I would not want to emulate—for example, 1x1 matrices are treated as scalars for matrix multiplication, which makes matrix multiplication non-associative, and the last time I looked if you had “X=expression1; expression2(X)” you could not always rewrite it as “expression2(expression1)”.

My point is not to criticize Matlab, which has been immensely successful in what it sets out to do, just to explain that I don’t want to use it as a precedent for anything.

>
>> Or arrays that
>> can’t return any values, because their underlying domains are empty?
>
> Same basic answer, although this seems a little less justifiable.
> However, it's probably good to do the Right Thing in edge cases.
> Someone may need it.

Again, I don’t know what the Right Thing is here.

Thanks for your comments.

Brad