Cross-language comparison: function map and similar

Stephan Houben stephanh42 at gmail.com.invalid
Sun Aug 20 02:56:47 EDT 2017


Op 2017-08-16, Steve D'Aprano schreef <steve+python at pearwood.info>:
> Are there language implementations which evaluate the result of map()
> (or its equivalent) in some order other than the obvious left-to-right
> first-to-last sequential order? Is that order guaranteed by the
> language, or is it an implementation detail?
>
> Standard library functions implementing an explicitly "parallel map"
> or "threaded map" are also relevant. (Less interested in third-party
> libraries, unless they're practically a standard for the language in
> question.)

C++17 has such a facility in its standard library.

std::transform (and many other functions operating on sequences, but
you asked for a map() equivalent) takes an optional
"execution_policy" parameter which indicates if the operation 
should be run sequentially (the default) or can be parallellized.

See: http://en.cppreference.com/w/cpp/algorithm/transform

Stephan



More information about the Python-list mailing list