Serial execution

unified_map.univariate.serial.for_loop(function, argument_list)

Apply a univariate function to a list of arguments in a serial fashion.

Uses Python’s built-in for statement.

Parameters:
  • function – A callable object that accepts one argument
  • argument_list – An iterable object of input arguments
Returns:

List of output results

Example

>>> def square(x):
...     return x**2
...
>>> for_loop(square, [1, 2, 3, 4, 5])
[1, 4, 9, 16, 25]

References

unified_map.univariate.serial.generator_expression(function, argument_list)

Apply a univariate function to a list of arguments in a serial fashion.

Uses Python’s built-in generator expressions.

Parameters:
  • function – A callable object that accepts one argument
  • argument_list – An iterable object of input arguments
Returns:

List of output results

Example

>>> def square(x):
...     return x**2
...
>>> generator_expression(square, [1, 2, 3, 4, 5])
[1, 4, 9, 16, 25]

References

unified_map.univariate.serial.generator_function(function, argument_list)

Apply a univariate function to a list of arguments in a serial fashion.

Uses Python’s built-in generator function syntax to return a generator iterator.

Parameters:
  • function – A callable object that accepts one argument
  • argument_list – An iterable object of input arguments
Returns:

List of output results

Example

>>> def square(x):
...     return x**2
...
>>> generator_function(square, [1, 2, 3, 4, 5])
[1, 4, 9, 16, 25]

References

unified_map.univariate.serial.list_comprehension(function, argument_list)

Apply a univariate function to a list of arguments in a serial fashion.

Uses Python’s built-in list comprehension.

Parameters:
  • function – A callable object that accepts one argument
  • argument_list – An iterable object of input arguments
Returns:

List of output results

Example

>>> def square(x):
...     return x**2
...
>>> list_comprehension(square, [1, 2, 3, 4, 5])
[1, 4, 9, 16, 25]

References

unified_map.univariate.serial.map(function, argument_list)

Apply a univariate function to a list of arguments in a serial fashion.

Uses Python’s built-in map() function.

Parameters:
  • function – A callable object that accepts one argument
  • argument_list – An iterable object of input arguments
Returns:

List of output results

Example

>>> def square(x):
...     return x**2
...
>>> map(square, [1, 2, 3, 4, 5])
[1, 4, 9, 16, 25]

References

unified_map.univariate.serial.starmap(function, argument_list)

Apply a univariate function to a list of arguments in a serial fashion.

Uses the starmap() function from itertools in Python’s standard library and Python’s built-in zip() function.

Parameters:
  • function – A callable object that accepts one argument
  • argument_list – An iterable object of input arguments
Returns:

List of output results

Example

>>> def square(x):
...     return x**2
...
>>> starmap(square, [1, 2, 3, 4, 5])
[1, 4, 9, 16, 25]

References