News for hackers. Stuff that matters.
Re:Reducers, transducers and core.async in Clojure by azag0 on Wednesday June 07, 2017 @11:29AM (#14507215)
Or, with a little setup, the Closure snippet

    (def s (range 0 10))
    (reduce + (map inc (filter even? s)))
can be turned into Python's

    from functools import reduce
    from operator import add

    def inc(x): return x + 1
    def even(x): return x % 2 == 0


    s = range(0, 10)
    reduce(add, map(inc, filter(even, s)))
Everything's lazy in there. It's just... not very Pythonic.

There are no comments on this comment yet.