renkun-ken / rlist

A Toolbox for Non-Tabular Data Manipulation
Other
204 stars 28 forks source link

Explanations on differences/complementarities with magrittr and purrr #119

Open briatte opened 7 years ago

briatte commented 7 years ago

Both your rlist and pipeR packages look ultra-interesting, but I am failing to understand exactly how different they are from other packages, namely magrittr and purrr.

I do not understand, for instance, how pipeR::%>>% differs from magrittr:%>%.

Similarly, I would appreciate a comparison of how list operations differs in purrr and rlist, as well as a discussion of how well both packages might work together, if they accomplish different things.

Last, and this is purely cosmetic, but how about making aliases with underscores in function names, e.g. list_filter, in order to have your package blend nicely with packages in which underscores are used to separate the package prefix from the verb (e.g. stringr)?

Thanks in advance for your time, and again, congratulations for writing up these interesting packages.

matthewcrews commented 7 years ago

The major difference between the pipeR::%>>% and magrittr::%>% is that the pipeR function is more straightforward to reason about than the magrittr function. I exclusively use the pipeR function for this reason. magrittr has a lot of logic to figure out where to pipe the argument into the function. pipeR's logic is straightforward, if there are no containing brackets it will pipe the value into the first argument. If there are brackets, it will pipe the value into the . symbol. This also makes the pipeR implementation faster. This does not matter much if you are only calling the %>% function a couple of times but in hot loops it can make a significant difference.

Here is a link to where Kun Ren explains this in detail: https://renkun.me/blog/2014/08/08/difference-between-magrittr-and-pipeR.html