Add( list, elm )
Add adds the element elm to the end of the list list, i.e., it is
equivalent to the assignment
list[ Length(list) + 1 ] := elm.
The list is automatically enlarged to make room for the new element.
Add returns nothing, it is called only for its side effect.
Note that adding to a list changes the list. The ability to change an object is only available for lists and records (see Identical Lists).
To add more than one element to a list use
Append (see Append).
gap> l := [ 2, 3, 5 ];; Add( l, 7 ); l; [ 2, 3, 5, 7 ]
Previous Up Top Next