top | item 39065934

(no title)

tandav | 2 years ago

shameless plug: I maintain a small library to do functional pipes. You can write:

    (
        range(10)
        | Map(lambda x: x * 10)
        | Filter(lambda x: x % 2 == 0)
        | Reduce(lambda a, b: a + b)
    )
and more. https://tandav.github.io/pipe21/

most operators are basically oneliners: https://github.com/tandav/pipe21/blob/master/pipe21.py#L17

I also maintain a list of libraries which uses pipeline/chain syntax: https://tandav.github.io/pipe21/similar-tools/

discuss

order

throwaway914|2 years ago

This is very cool. I remember I got sucked into things like Ramda going down this functional programming rabbit hole :-)

https://ramdajs.com/

retrocryptid|2 years ago

The first thing I did when I encountered js in the 90s was write map and reduce. After leaving Mozilla I published a npm package with my hacks. I was very happy to find someone else had done a much better job at it and was actually maintaining it.

also, have you seen lazyjs? Also very cool.