array questions



>>>>> "Camm" == Camm Maguire <camm at enhanced.com> writes:

    Camm> Well, certain compiler optimizations are keyed to the 'array symbol.
    Camm> For example, all typing.  subtypep cannot deal with `(maxima::array
    Camm> fixnum *), it appears as an unknown type.

If maxima code does that and it's really a Lisp array, the code is
probably wrong and should read cl:array instead.  We should fix
these. 

    >> 
    Camm> (defmacro arraycall (ign array &rest dims) ign
    Camm> `(aref (the ,ign ,array) . ,dims))
    >> 
    >> A peek at some of the uses of arraycall shows that it's something like
    >> (arraycall flonum aarray index).  Won't your macro expansion produce
    >> (aref (the flonum aarray) index) which is totally wrong?
    >> 

    Camm> My apologies, I meant:

    Camm> (defmacro arraycall (ign array &rest dims) ign
    Camm> 	  `(aref (the (lisp::array ,ign) ,array) . ,dims))

    Camm> This seems to work here, but I've got other bugs which may obscure
    Camm> things in my current testing.

This would make it significantly worse for cmucl and sbcl because the
declaration is saying it's an array of unknown dimensions.  You might
want to do

(aref (the (lisp::array ,ign ,(length dims)) ,array) . ,dims)),

but that could still hurt cmucl/sbcl if the compiler actually knew the
type of ,array before hand.  Say, for example that the array was
actually a 1D simple-array of double-floats, with a known length.

Ray