==== MAP ====
----
Do a procedure on each element of a list, recursively
----
^ __Input Stack__ ^^ ^ __Output Stack__ ^
| **Ldata** | **Pexec** | **→** | **Ldata-upd** |
| **Ldata** | **Nexec** | **→** | **Ldata-upd** |
| //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 ''MAP'' command ''[[manual:chapter6:operators:cmd_ovr_eval|EVAL]]''uates a specified program (or a variable which contains one) to a list of objects or values. If one of the objects is a list, ''MAP'' will apply the program recursively to the items in the inner list.\\
\\
''MAP'' is nominally designed for **Pexec** (or **Nexec**) __requiring one argument and returning one result__.
----
''MAP'' is fully equivalent to its **userRPL** counterpart.
----
**__Input__**
4:
3:
2: { 1 2 { X Y } }
1: « 2 * »
…………………………………………………………………………………………………………
MAP
\\
**__Output__**
4:
3:
2:
1: { 2 4 { 'X*2' 'Y*2' } }
…………………………………………………………………………………………………………
----
{{page>manual:chapter6:lists&nofooter&noeditbtn&inline}}