ADD
Synopsis
Concatenate lists and/or elements
Description
The ADD command concatenates lists or adds an element to a new list. It's not necessary that either the first or the second argument is a list: in this case ADD will create a new list containing both: in other words, single objects are treated as one-element lists.
Compatibility
ADD is not fully equivalent to its userRPL counterpart.
In particular:
- in userRPL list concatenation is performed by the
+operator, whileADDis the command to parallel process the addition; - in userRPL at least one of the arguments must be a list.
Usage
Input
4:
3:
2: { 1 1 2 3 }
1: { 5 8 13 }
…………………………………………………………………………………………………………
ADD
Output
4:
3:
2:
1: { 1 1 2 3 5 8 13 }
…………………………………………………………………………………………………………
Related Commands
| Command | Short Description | |
|---|---|---|
| →LIST | Assemble a list from its elements | |
| LIST→ | Split a list into its elements | |
| DOLIST | Do a procedure with elements of lists | CHANGED |
| DOSUBS | Do a procedure on a subset of a list | CHANGED |
| MAP | Do a procedure on each element of a list, recursively | |
| MAPLIST→ | Do a procedure on each element recursively, return individual elements | NEW |
| STREAM | Do a procedure on consecutive elements of a list | |
| ΔLIST | First differences on the elements of a list | |
| ΣLIST | Sum of all elements in a list | CHANGED |
| ΠLIST | Product of all elements in a list | CHANGED |
| ADD | Concatenate lists and/or elements | CHANGED |
| SORT | Sort elements in a list | |
| REVLIST | Reverse the order of elements in a list | |
| ADDROT | Add elements to a list, keep only the last N elements | NEW |
| SEQ | Assemble a list from results of sequential procedure |