[Top][All Lists]

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

[Gcl-devel] Re: [Maxima] array questions

From: Camm Maguire
Subject: [Gcl-devel] Re: [Maxima] array questions
Date: 29 Mar 2006 18:08:39 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2


Raymond Toy <address@hidden> writes:

> >>>>> "Camm" == Camm Maguire <address@hidden> 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. 

OK, I can provide some eg. if helpful.

>     >> 
>     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)),

This would be ok too.

> 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.

Well, then the code should be in error (i.e. the arraycall
invocation), no?  GCL doesn't need this necessarily either when the
array is a lexical produced by make-array or the like, but there are
several special variables with array bindings which are not declaimed:
e.g. factor.lisp:

(declare-top(special afixn fctcfixn invcfixn))

Take care,

> Ray

Camm Maguire                                            address@hidden
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]