assigning to long list please use Arrays - Maple Help

Home : Support : Online Help : System : Error Message Guide : assigning to long list please use Arrays

Error, assigning to a long list, please use Arrays

 Description Lists in Maple are immutable, that is, with l[1] := 2 you create a copy of l and change the first element of this second list. You now have two lists in memory. Repeating this many times produces a different copy of the list each time; as a result, this error may occur because copying the entire list requires a significant amount of memory.   Arrays, on the other hand, can be modified in place and therefore use less memory. For example, by reassigning A[1], you do not allocate new memory.

Examples

 > $l≔\left[\mathrm{seq}\left(i,i=1..200\right)\right]:\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}l\left[1\right]≔2;$

Solution: use Arrays

 >
 ${{l}}_{{1}}{:=}{2}$ (2.1)
 > $l$
 $\left[\begin{array}{c}{\mathrm{1 .. 200}}{\mathrm{Array}}\\ {\mathrm{Data Type:}}{\mathrm{anything}}\\ {\mathrm{Storage:}}{\mathrm{rectangular}}\\ {\mathrm{Order:}}{\mathrm{Fortran_order}}\end{array}\right]$ (2.2)