append
append(l_list1l_list2) =>l_resultappend(o_tableg_assoc) =>o_tableappend(o_table1o_table2) =>o_newTable
Description
Creates a list containing the elements of l_list1 followed by the elements of l_list2 or returns the original association table including new entries.
The top-level list cells of l_list1 are duplicated and the cdr of the last duplicated list cell is set to point to l_list2; therefore, this is a time-consuming operation if l_list1 is a long list.
This is a slow operation and the functions tconc, lconc, and nconc can be used instead for adding an element or a list to the end of a list. The command cons is even better if the new list elements can be added to the beginning of the list.
The append function can also be used with association tables as shown in the second syntax statement. Key/value pairs are added to the original association table (not to a copy of the table). This function should be used mainly in converting existing association lists or disembodied property lists to an association table.
Arguments
Value Returned
|
A list containing elements of l_list1 followed by elements of l_list2. |
|
Examples
/* List Example */
append( '(1 2) '(3 4) )
=> (1 2 3 4)
/* Association Table Example */
myTable = makeTable("myAssocTable")
=> table:myAssocTable
myTable['a] = 1
=> 1
append(myTable '((b 2) (c 3)))
=> table:myAssocTable
/* Check the contents of the assoc table */
tableToList(myTable)
=> ((a 1) (b 2) (c 3))
Related Topics
Return to top