==== STREAM ====
----
Assemble a list from results of sequential procedure
----
^ __Input Stack__ ^^ ^ __Output Stack__ ^
| **Ldata** | **Pexec** | **→** | **Oresult** |
| **Ldata** | **Nexec** | **→** | **Oresult** |
| //Level 2// | //Level 1// | //→// | //Level 1// |
{{page>manual:chapter6:aux:legend&nofooter&noeditbtn&inline}}
| **Keyword type** | [[manual:chapter5:basics#commands|Command]] ||
| **Parallel list processing capabilities** | [[manual:chapter5:listproc#group-2commands-that-must-use-dolist-to-parallel-process|Group 2]] | //Commands that must use //''[[manual:chapter6:lists:cmd_cmddolist|DOLIST]]''// to parallel process// |
| **Affected by flags** | //None// ||
----
The ''STREAM'' command moves the first two elements from **Ldata** onto the stack, ''[[manual:chapter6:operators:cmd_ovr_eval|EVAL]]''uating a program or an identifier. Then moves the next element (if any) onto the stack, and ''[[manual:chapter6:operators:cmd_ovr_eval|EVAL]]''uates **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__.
----
''STREAM'' is not fully equivalent to its **userRPL** counterpart.
In particular:
* the program launched by ''STREAM'' operates in a protected stack environment: no elements present on the stack before ''STREAM'' is launched can be reached or altered.
----
**__Input__**
4:
3:
2: { "A" "B" "C" "D" }
1: « SWAP + »
…………………………………………………………………………………………………………
STREAM
\\
**__Output__**
4:
3:
2:
1: "DCBA"
…………………………………………………………………………………………………………
----
{{page>manual:chapter6:lists&nofooter&noeditbtn&inline}}