I have detected that it is possible to write directly into a Maxima list or
Maxima matrix using the flag $use_fast_arrays:true;
(%i8) use_fast_arrays:true$
Bind a list with 9 values to the symbol a:
(%i11) a:[1,2,3,4,5,6,7,8,9];
(%o11) [1,2,3,4,5,6,7,8,9]
Fast arrays are on. Try to generate a fast array with one value:
(%i12) a[3]:333;
(%o12) 333
What has happend is that we have set the third value in the list:
(%i14) a;
(%o14) [1,2,333,4,5,6,7,8,9]
Again we change a value in the list:
(%i15) a[6]:666;
(%o15) 666
(%i16) a;
(%o16) [1,2,333,4,5,666,7,8,9]
I do not know if this feature is really wanted. But it causes series failures as
described in the bug report SF[887639]. You get a lot of strange things and at
the end the Maxima session is killed. The reason is that the code do not do any
checks for the range of the index and does not check the type of the index.
This is the code in the function arrstore in mlisp.lisp which is responsible for
this behavior (I have added an extra flag to hide this code completely):
((and $use_fast_arrays_with_list (eq the-type 'list))
(cond ((eq (caar tem) 'mlist)
(setq index (car index))
(setf (nth index tem) r)
r)
((eq (caar tem) '$matrix)
(setf (nth (second index) (nth (first index) tem)) r)
r)
(t
(error "The value of ~A is not a hash-table ,an ~
array, Maxima list, or a matrix" (caar l)))))
The variable tem gets the value of the symbol $a which is bound to the list in
the example above. This happens a bit earlier at the beginning of the function
arrstore.
The testsuite and the share_testsuite have no problems when I hide this code.
Fortunately there seems to be no code which uses this functionality of
$use_fast_arrays.
It may be possible to improve this code (check range of index, ...), but I think
it should be screened or perhaps completely cut out.
Any comment?
Dieter Kaiser