check if an object is or contains mutable objects
The type(expr, mutable) calling sequence returns true if if expr is a mutable object or contains mutable objects.
A mutable object is a Maple expression whose contents can change without its identity changing. The mutable objects in Maple are of type table (which includes array), rtable (which includes Array, Vector, and Matrix), module (which includes record and object), and procedure.
For example, an element in an Array can be changed, yet it is still the same Array, so an array is mutable. On the other hand, "changing" an element in a list creates a new list, and any references to the original list will not see the change. A list is immutable.
A procedure is considered mutable because it can have a remember table (even if it does not have the remember option).
In general, a list is not mutable.
L ≔ a,b,c,d
L0 ≔ L
This does not change the lists in-place, and in fact this syntax for "changing" a list is only supported for small lists, as it is very inefficient.
L32 ≔ e
The original lists are unchanged, because lists are not mutable.
A list containing an Array is mutable because the Array is mutable.
L ≔ a,b,Array⁡c,d
This changes the contents of the Array in-place, and thus the containing list is unaffected.
Download Help Document