[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: various comments

Jussi Piitulainen wrote:

If both (vector? arr) and (array? arr) yield #t, then (vector-ref arr
k) must do what (array-ref arr k) does, and so on. To implement that,
one should first have disjoint types, (r5rs-vector? o) and (array? o),
and then make (vector? o) be their sum (or (r5rs-vector? o) (array?
o)), and (vector-ref o k) would dispatch to one of (r5rs-vector-ref o
k) or (array-ref o k).

Not sure what you mean, but it sounds wrong.  Instead we should follow
logic and Common Lisp (or at least let implementations have that option):
(vector? obj) should imply (array? obj).  The reverse would be true if you
take the view that arrays are nested vectors, but that runs into problems in
de-generative cases of a 0-rank array. It also is difficult to distinguish a
0*M array from a 0*N array since you can't really distinguish a 0-length
vector each of whose non-existent elements is an M-length vectors from a
0-length vector of N-length vectors. That is unless you can associate "types" with empty vectors. Some APL dialects to that, and it gets a little strange.

   --Per Bothner