Add elements to a list, keeping only the last N elements
The ADDROT command adds element to a list just like the command ADD does, but with a difference: if the list grows larger than Isize elements, the first one gets removed.
ADDROT is specific to newRPL and has no direct equivalent in userRPL.
Input
4:
3: { A B C }
2: X
1: 3
…………………………………………………………………………………………………………
ADDROT
Output
4:
3:
2:
1: { B C X }
…………………………………………………………………………………………………………
| 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 |