Re:More intuitive partial function application in Python
by cgrimm1994 on Monday February 21, 2022 @09:21AM
(#30416154)
Sure, 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.
Re:More intuitive partial function application in Python
by throwamon on Monday February 21, 2022 @11:32AM
(#30417653)
Sorry, I should have worded my comment differently, I didn't mean to sound accusatory or dismissive.
Re:More intuitive partial function application in Python
by cgrimm1994 on Monday February 21, 2022 @12:53PM
(#30418586)
No worries!
(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
range(10) |> map$(pow$(?, 2)) |> list
There were others but I can't remember which now.