Show pageDiscussionOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ==== MAP ==== <callout type="primary" color="" icon="fa fa-book" title="Synopsis"> ---- Do a procedure on each element of a list, recursively </callout> <callout color="green" icon="fa fa-indent" title="Stack Diagram"> ---- ^ __Input Stack__ ^^ ^ __Output Stack__ ^ | **L<sub>data</sub>** | **P<sub>exec</sub>** | **→** | **L<sub>data-upd</sub>** | | **L<sub>data</sub>** | **N<sub>exec</sub>** | **→** | **L<sub>data-upd</sub>** | | //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// || </callout> <callout color="orangered" icon="fa fa-comment" title="Description"> ---- 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 **P<sub>exec</sub>** (or **N<sub>exec</sub>**) __requiring one argument and returning one result__. </callout> <callout type="success" icon="true" title="Compatibility"> ---- ''MAP'' is fully equivalent to its **userRPL** counterpart. </callout> <callout type="info" icon="true" title="Usage"> ---- **__Input__** <code> 4: 3: 2: { 1 2 { X Y } } 1: « 2 * » ………………………………………………………………………………………………………… MAP </code> \\ **__Output__** <code> 4: 3: 2: 1: { 2 4 { 'X*2' 'Y*2' } } ………………………………………………………………………………………………………… </code> </callout> <callout color="darkgray" icon="fa fa-hand-o-right" title="Related Commands"> ---- {{page>manual:chapter6:lists&nofooter&noeditbtn&inline}} </callout> manual/chapter6/lists/cmd_map.txt Last modified: 2021/10/04 14:53by jojo1973