3 ms·
Python is multi-paradigm, I think everyone would agree, but I think they removed the ability to do this with function composition like map, reduce and filter in
by didibus 9y ago
Python is multi-paradigm, I think everyone would agree, but I think they removed the ability to do this with function composition like map, reduce and filter in v3 no? Specifically in favor of list comprehensions and generators?
Anyways, if you do it with list comprehensions in Clojure it would look like this:
(apply + (for [x (range 10)
:when (even? x)]
(inc x)))
- eliben 9y agoIn Python 3 functions like reduce were moved to the functools module, not removed from the language.