10 May
2015
10 May
'15
3:20 a.m.
On Sun, May 10, 2015 at 03:51:38AM +0300, Koos Zevenhoven wrote:
Another way to deal with elementwise operations on iterables would be to make a small, mostly backwards compatible change in map:
When map is called with just one argument, for instance map(square), it would return a function that takes iterables and maps them element-wise.
Now it would be easier to use map in pipelines, for example:
rms = sqrt @ mean @ map(square)
Or just use a tiny helper function: def vectorise(func): return partial(map, func) rms = sqrt @ mean @ vectorise(square) -- Steve