4 ms·
This is not a new idea. siuba (a dplyr-like Pandas alternative) is one project that does it, and it also has a "pipeline operator": https://github.com/machow/si
by throwamon 5y ago
This is not a new idea. siuba (a dplyr-like Pandas alternative) is one project that does it, and it also has a "pipeline operator": https://github.com/machow/siuba https://github.com/machow/siuba
(mtcars
>> group_by(_.cyl)
>> summarize(avg_hp = _.hp.mean())
)
(Edit: ok, it seems siuba doesn't have the "parameter fixing" thing.)
Related: Coconut - a functional superset of Python - https://github.com/evhub/coconut https://github.com/evhub/coconut
range(10) |> map$(pow$(?, 2)) |> list
There were others but I can't remember which now.
- cgrimm1994 5y agoSure, I'm not claiming to have originated the idea of using _ or some other placeholder to return partially applied functions. Lots of languages have some kind of shorthand syntax for this. I just hadn't seen it done in Python before. Coconut looks cool btw! I'll give it a closer look soon.
- throwamon 5y agoSorry, I should have worded my comment differently, I didn't mean to sound accusatory or dismissive.
- cgrimm1994 5y agoNo worries!