Did you know that the MAP function has three parameters?
The MAP function is used to do the same data on data sets. For example, with its help it is convenient to give data types:
>>> chr_nums = ['1', '2', '3', '4', '5']
>>> List (MAP (int, chr_nums))
Or round the values:
>>> List (Map (Round, Floats))
But MAP has another third parameter that is used to transfer arguments to the processing function.
For example, if we want to build all the numbers in a square, then deuces can be transferred to the arguments as a list:
>>> List (MAP (Pow, Range (10), [2]*10))
Yu0, 1, 4, I, 16, 25, 36, 49, 64, 81.
The same with rounding:
>>> List (Map (Round, Floats, [3]*Len (Floats)))
>>> from itertools Import Repeat
>>> List (MAP (Round, Floats, Repeat (1)))
Repeat endlessly repeats the desired constant, and MAP focuses on the shortest of the introduced sequences. It turns out exactly as many parameters for MAP as necessary.