[Maxima] Maxima lists and $use_fast_arrays
drdieterkaiser at web.de
Thu Jan 8 17:05:33 CST 2009
Am Mittwoch, den 07.01.2009, 22:16 -0700 schrieb Robert Dodier:
> On Wed, Jan 7, 2009 at 7:20 PM, Harald Geyer <harald at lefant.net> wrote:
> I am confused as well --- I don't see what problem is illustrated by
> the example.
Yes, now I am confused too. I have done a wrong conclusion.
I have worked on the bug report SF "listarray when
use_fast_arrays : true". But I have done this work only with GCL and not
CLISP. Thus I have not seen that I have got a special problem with GCL
At first again the example from a post of the bug report:
b => error OK
b: 5$ => no error ???
b => error ???
b => [1,2] ??? setting b didn't give an error, but has no
effect on b
c => #<hash-table 234234234> (ridiculous internal thingy
This example was done with GCL-2-5.0 and Maxima 5.9.0
1. I did not recognize that it is possible to set the elements of a
Maxima list like an array e.g. (is this documented?)
2. There is a difference using use_fast_arrays:false or true. In the
case of false we get a Maxima error when we try to set a value with
wrong index. When we use_fast_arrays:true we get a Lisp error (not for
5 - index out of range
-- an error. To debug this try debugmode(true);
Maxima encountered a Lisp error:
(SETF NTH): index 5 is too large for ((MLIST SIMP) 1 2 3)
To reenable the Lisp debugger set *debugger-hook* to nil.
3. If I try the above example with GCL 2.6.8 I can get something like
(%i8) b:4; /* No error message */
(%o9) [1,2,3] /* Nothing has happened? */
(%i14) c; /* Some expressions later. */
Universal error handler called recursively (:ERROR NIL ...
At this point the Maxima session is killed.
At first it seems that nothing had happened like in the bug report. But
that is not true. The memory is damaged. When I continue the session
first a lot of strange things can happen. Some time later the session is
This does not happen when using use_fast_arrays:false. In this case
Maxima gives correct error messages when the index is wrong.
With use_fast_arrays:true Maxima uses a different algorithm to check the
index and to access the list values.
With GCL the memory is damaged when we try to write into the list with a
So I think for the case fast_arrays:true a check of the correct index
has to be added to avoid a Lisp error e.g. for CLISP and a memory damage
More information about the Maxima