STREAM
Synopsis
Assemble a list from results of sequential procedure
Description
The STREAM command moves the first two elements from Ldata onto the stack, EVALuating a program or an identifier. Then moves the next element (if any) onto the stack, and EVALuates Pexec (or Nexec) again using the previous result and the new element. Repeats this until Ldata is exhausted, and returns the final result.
STREAM is nominally designed for Pexec (or Nexec) requiring two arguments and returning one result.
Compatibility
STREAM is not fully equivalent to its userRPL counterpart.
In particular:
- the program launched by
STREAMoperates in a protected stack environment: no elements present on the stack beforeSTREAMis launched can be reached or altered.
Usage
Input
4:
3:
2: { "A" "B" "C" "D" }
1: « SWAP + »
…………………………………………………………………………………………………………
STREAM
Output
4:
3:
2:
1: "DCBA"
…………………………………………………………………………………………………………
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 |