Maxima lists and $use_fast_arrays



Hi Dieter!

> I have detected that it is possible to write directly into a Maxima list or
> Maxima matrix using the flag $use_fast_arrays:true;

I think either you or me are confused: I know that use_fast_arrays has
issues, but the behaviour you describe below doesn't depend on the 
value of this flag.

> (%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 a
> t
> the end the Maxima session is killed. The reason is that the code do not do a
> ny
> 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 i
> n
> the example above. This happens a bit earlier at the beginning of the functio
> n
> 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 th
> ink
> it should be screened or perhaps completely cut out.
> 
> Any comment?
> 
> Dieter Kaiser
> 
> 
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima