Darwin Help

Back to Index

append

Function append - append to a list, set or structure

Calling Sequence  append(L,e_1..e_k)
Parameters
NameTypeDescription

L a list, set or structure 
e_i an arbitrary element 
Return Type  {list,set,structure}
Synopsis This function appends e_1..e_k to the list or structure L. If the original list or set or structure has length less than 10, it appends on a new copy of L. Otherwise it appends it to L and hence (likely) modifies the original object. So if the first argument of append should not be destroyed, the appending should be done on a copy of L. Appending is written in a way that is efficient, even in case of appending thousands of elements, one at a time, to an empty list. Appending to sets, although efficient from the data enlargement point of view, is not efficient as every new set is reordered. If a large set is to be built by appending one element at a time, it is much more efficient to use a list and convert the list to a set once the appending is finished. This function accepts a variable number of additional arguments.
Examples
> append( ABC(1,2,3), 4, 5 );
ABC(1,2,3,4,5)
> append( CreateArray(1..11,7), 77 );
[7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 77]