markfairbanks / tidypolars

Tidy interface to polars
http://tidypolars.readthedocs.io
MIT License
321 stars 10 forks source link

purrr functions!? #205

Closed exsell-jc closed 1 year ago

exsell-jc commented 1 year ago

I noticed that in tidytable, you have purrr functions like map.(), but not in tidypolars.

Using for loops + lambda functions are just not desirable for collaborative coding / code readability/comprehension. In Python, even if there is a bit of sacrifice in performance, if it allows better code readability, it would be really nice to have.

Would something like map.() be in the scope of this repo?

markfairbanks commented 1 year ago

As of right now tidypolars is just for dplyr/tidyr functions - so I don't think that adding purrr functions is in scope. But I'll leave this open for now because I do want to look into it a bit more.

markfairbanks commented 1 year ago

One thing worth noting - python already has a map() function built in that is called slightly differently than R. It's also a bit more extensible than purrr::map() because it's essentially map/map2/pmap all built into one.

R Python
map(list, func) map(func, list)
map2(list1, list2, func) map(func, list1, list2)
pmap(list(list1, list2, list3), func) map(func, list1, list2, list3)
markfairbanks commented 1 year ago

As I think about this more - I think I'm going to close this. I think python offers pretty solid options for iterations. Whether with map() or using zip() in list comprehensions.