View source code
							
							
						
								Display the source code in std/algorithm/iteration.d from which this
								page was generated on github.
							
						
							Report a bug
							
						
								If you spot a problem with this page, click here to create a
								Bugzilla issue.
							
						
							
								Improve this page
							
							
					
								Quickly fork, edit online, and submit a pull request for this page.
								Requires a signed-in GitHub account. This works well for small changes.
								If you'd like to make larger changes you may want to consider using
								local clone.
							
						Template std.algorithm.iteration.map
Implements the homonym function (also known as transform) present
in many languages of functional flavor. The call map!(fun)(range)
returns a range of which elements are obtained by applying fun(a)
left to right for all elements a in range. The original ranges are
not changed. Evaluation is done lazily.
						
				template map(fun...)
				;
						
					
				Contained Functions
| Name | Description | 
|---|---|
| map | 
Parameters
| Name | Description | 
|---|---|
| fun | one or more transformation functions | 
See Also
Example
import stdExample
Multiple functions can be passed to map. In that case, the
element type of map is a tuple containing one element for each
function.
auto sums = [2, 4, 6, 8];
auto products = [1, 4, 9, 16];
size_t i = 0;
foreach (result; [ 1, 2, 3, 4 ]Example
You may alias map with some function(s) to a symbol and use
it separately:
import stdAuthors
License
					Copyright © 1999-2022 by the D Language Foundation | Page generated by ddox.