|- valign="top"
| [[Common Lisp]]
| <ttcode>(mapcar ''func'' ''list'')</ttcode>
| <ttcode>(mapcar ''func'' ''list1'' ''list2'')</ttcode>
| <ttcode>(mapcar ''func'' ''list1'' ''list2'' ...)</ttcode>
|
| stops after the length of the shortest list
|- valign="top"
| [[C++]]
| <ttcode>std::transform(<wbr/>''begin'', ''end'', ''result'', ''func'')</ttcode>
| <ttcode>std::transform(<wbr/>''begin1'', ''end1'', ''begin2'', ''result'', ''func'')</ttcode>
|
| in header <algorithm><br /> ''begin'', ''end'', & ''result'' are iterators<br /> result is written starting at ''result''
|- valign="top"
| [[C Sharp (programming language)|C#]] 3.0
| <ttcode>''ienum''.Select(''func'')</ttcode>
|
|
| <ttcode>Select</ttcode> is an extension method<br /> ''ienum'' is an IEnumerable<br /> Similarly in all .NET languages
|
|- valign="top"
| [[C Sharp (programming language)|C#]] 4.0
| <ttcode>''ienum''.Select(''func'')</ttcode>
| <ttcode>''ienum1''.Zip(''ienum2'', ''func'')</ttcode>
|
| <ttcode>Select</ttcode> is an extension method<br /> ''ienum'' is an IEnumerable<br /> Similarly in all .NET languages
| stops after the shortest list ends
|- valign="top"
| [[CFML]]
| <ttcode>obj.map(func)</ttcode>
|
|
| Where <ttcode>obj</ttcode> is an array or a structure. <ttcode>func</ttcode> receives as arguments each item's value, its index or key, and a reference to the original object.
|
|- valign="top"
| [[Clojure]]
| <ttcode>(map ''func'' ''list'')</ttcode>
| <ttcode>(map ''func'' ''list1'' ''list2'')</ttcode>
| <ttcode>(map ''func'' ''list1'' ''list2'' ...)</ttcode>
|
| Clojure: stops after the shortest list ends
|- valign="top"
| [[Erlang (programming language)|Erlang]]
| <ttcode>lists:map(''Fun'', ''List'')</ttcode>
| <ttcode>lists:zipwith(''Fun'', ''List1'', ''List2'')</ttcode>
| <ttcode>''zipwith3''</ttcode> also available
|
| Lists must be equal length
|- valign="top"
| [[F sharp (programming language)|F#]]
| <ttcode>List.map ''func'' ''list''</ttcode>
| <ttcode>List.map2 ''func'' ''list1'' ''list2''</ttcode>
|
| Functions exist for other types (''Seq'' and ''Array'')
|- valign="top"
| [[Haskell (programming language)|Haskell]]
| <ttcode>map ''func'' ''list''</ttcode>
| <ttcode>zipWith ''func'' ''list1'' ''list2''</ttcode>
| <ttcode>zipWith''n'' ''func'' ''list1'' ''list2'' ...</ttcode>
| <ttcode>''n''</ttcode> corresponds to the number of lists; predefined up to <ttcode>''zipWith7''</ttcode>
| stops after the shortest list ends
|- valign="top"
|- valign="top"
| [[Haxe]]
| <ttcode>''array''.map(''func'')<br>
''list''.map(''func'')<br>
Lambda.map(''iterable'', ''func'')
</ttcode>
|
|
|- valign="top"
| [[J (programming language)|J]]
| <ttcode>''func'' ''list''</ttcode>
| <ttcode>''list'' ''func'' ''list''</ttcode>
| <ttcode>''func''/ ''list1'', ''list2'', ''list3'', : ''list4''</ttcode>
| J's array processing capabilities make operations like map implicit
| length error if lists not equal
|- valign="top"
| [[Java (programming language)|Java]] 8+
| <ttcode>''stream''.map(''func'')</ttcode>
|
|
| [[JavaScript]] 1.6<br>[[ECMAScript]] 5
| [https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/map ''array''#map(''func'')]
| <ttcode>''List1''.map(function (elem1, i) { <br />return ''func''(elem1, ''List2''[i]); })</ttcode>
| <ttcode>''List1''.map(function (elem1, i) { <br />return ''func''(elem1, ''List2''[i], ''List3''[i], ...); })</ttcode>
| Array#map passes 3 arguments to ''func'': the element, the index of the element, and the array. Unused arguments can be omitted.
| Stops at the end of ''List1'', extending the shorter arrays with ''undefined'' items if needed.
|- valign="top"
| [[Logtalk]]
| <ttcode>map(''Closure'', ''List'')</ttcode>
| <ttcode>map(''Closure'', ''List1'', ''List2'')</ttcode>
| <ttcode>map(''Closure'', ''List1'', ''List2'', ''List3'', ...) (up to seven lists)</ttcode>
| Only the ''Closure'' argument must be instantiated.
| Failure
|- valign="top"
| [[Mathematica]]
| <ttcode>''func'' /@ ''list'' <br /> Map[''func'', ''list'']</ttcode>
| <ttcode>MapThread[''func'', {''list1'', ''list2''}]</ttcode>
| <ttcode>MapThread[''func'', {''list1'', ''list2'', ...}]</ttcode>
|
| Lists must be same length
|- valign="top"
| [[Maxima (software)|Maxima]]
| <ttcode>map(''f'', ''expr<sub>1</sub>'', ..., ''expr<sub>n</sub>'')<br />maplist(''f'', ''expr<sub>1</sub>'', ..., ''expr<sub>n</sub>'')</ttcode>
|
|
|- valign="top"
| [[OCaml]]
| <ttcode>List.map ''func'' ''list''<br /> Array.map ''func'' ''array''</ttcode>
| <ttcode>List.map2 ''func'' ''list1'' ''list2''</ttcode>
|
|
|- valign="top"
| [[PARI/GP]]
| <ttcode>apply(''func'', ''list'')</ttcode>
|
|
|- valign="top"
| [[Perl]]
| <ttcode>map ''block'' ''list''<br /> map ''expr'', ''list''</ttcode>
|
|
| In ''block'' or ''expr'' special variable ''$_'' holds each value from list in turn.
| Helper <ttcode>''List::MoreUtils::each_array''</ttcode> combines more than one list until the longest one is exhausted, filling the others with <ttcode>''undef''.</ttcode>
|- valign="top"
| [[PHP]]
| <ttcode>array_map(''callback'', ''array'')</ttcode>
| <ttcode>array_map(''callback'', ''array1'',''array2'')</ttcode>
| <ttcode>array_map(''callback'', ''array1'',''array2'', ...)</ttcode>
| The number of parameters for ''callback''<br />should match the number of arrays.
| extends the shorter lists with ''NULL'' items
|- valign="top"
| [[Prolog]]
| <ttcode>maplist(''Cont'', ''List1'', ''List2'').</ttcode>
| <ttcode>maplist(''Cont'', ''List1'', ''List2'', ''List3'').</ttcode>
| <ttcode>maplist(''Cont'', ''List1'', ''...'').</ttcode>
| List arguments are input, output or both. Subsumes also zipWith, unzip, all
| Silent failure (not an error)
|- valign="top"
| [[Python (programming language)|Python]]
| <ttcode>map(''func'', ''list'')</ttcode>
| <ttcode>map(''func'', ''list1'', ''list2'')</ttcode>
| <ttcode>map(''func'', ''list1'', ''list2'', ...)</ttcode>
| Returns a list in Python 2 and an [[iterator]] in Python 3.
| <ttcode>''zip()''</ttcode> and <ttcode>''map()''</ttcode> (3.x) stops after the shortest list ends, whereas <ttcode>''map()''</ttcode> (2.x) and <ttcode>''itertools.zip_longest()''</ttcode> (3.x) extends the shorter lists with <ttcode>''None''</ttcode> items
|- valign="top"
| [[Racket (programming language)|Racket]]
| <ttcode>(map ''func'' ''list'')</ttcode>
| <ttcode>(map ''func'' ''list1'' ''list2'')</ttcode>
| <ttcode>(map ''func'' ''list1'' ''list2'' ...)</ttcode>
|
| lists must all have the same length
|- valign="top"
| [[Ruby (programming language)|Ruby]]
| <ttcode>''enum''.collect {''block''}<br /> ''enum''.map {''block''}</ttcode>
| <ttcode>''enum1''.zip(''enum2'')<wbr/>.map {''block''}</ttcode>
| <ttcode>''enum1''.zip(''enum2'', ...)<wbr/>.map {''block''} <br /> [''enum1'', ''enum2'', ...]<wbr/>.transpose.map {''block''}</ttcode>
| <ttcode>''enum'' is an Enumeration</ttcode>
| stops at the end of the object it is called on (the first list); if any other list is shorter, it is extended with ''nil'' items
|- valign="top"
| [[S (programming language)|S]]/[[R (programming language)|R]]
| <ttcode>lapply(''list'', ''func'')</ttcode>
| <ttcode>mapply(''func'', ''list1'', ''list2'')</ttcode>
| <ttcode>mapply(''func'', ''list1'', ''list2'', ...)</ttcode>
|
| Shorter lists are cycled
|- valign="top"
| [[Scala (programming language)|Scala]]
| <ttcode>''list''.map(''func'')</ttcode>
| <ttcode>(''list1'', ''list2'')<wbr/>.zipped.map(''func'')</ttcode>
| <ttcode>(''list1'', ''list2'', ''list3'')<wbr/>.zipped.map(''func'')</ttcode>
| note: more than 3 not possible.
| stops after the shorter list ends
|- valign="top"
| [[Scheme (programming language)|Scheme]]
| <ttcode>(map ''func'' ''list'')</ttcode>
| <ttcode>(map ''func'' ''list1'' ''list2'')</ttcode>
| <ttcode>(map ''func'' ''list1'' ''list2'' ...)</ttcode>
|
| lists must all have same length
|- valign="top"
| [[Smalltalk]]
| <ttcode>''aCollection'' collect: ''aBlock''</ttcode>
| <ttcode>''aCollection1'' with: ''aCollection2'' collect: ''aBlock''</ttcode>
|
|
|- valign="top"
| [[Standard ML]]
| <ttcode>map ''func'' ''list''</ttcode>
| <ttcode>ListPair.map ''func'' (''list1'', ''list2'') <br /> ListPair.mapEq ''func'' (''list1'', ''list2'')</ttcode>
|
| For 2-argument map, ''func'' takes its arguments in a tuple
| <ttcode>''ListPair.map''</ttcode> stops after the shortest list ends, whereas <ttcode>''ListPair.mapEq''</ttcode> raises <ttcode>UnequalLengths</ttcode> exception
|- valign="top"
| [[Swift (Apple programming language)|Swift]]
| <ttcode>''array''.map(''func'')</ttcode><br /> <ttcode>map(''sequence'', ''func'')</ttcode>
| <ttcode>map(Zip2(''sequence1'', ''sequence2''), ''func'')</code>
|
|
|