rmonad icon indicating copy to clipboard operation
rmonad copied to clipboard

Lost history in non-`rmonad` nesting

Open arendsee opened this issue 6 years ago • 0 comments

These all record the same history:

foo <- function(x){ "in foo" ; x %>>% sqrt }
bar <- function(x){ "in bar" ; foo(x)}
256 %>>% sqrt %>>% sqrt %>>% bar
16  %>>% sqrt %>>% bar
4   %>>% bar

This, for example, prevents the use of wrappers around pipeline functions.

foo <- function(x,y){ x %>>% prod(y) }
bar <- function(x){ foo(x, 2) }
# keeps history
16 %>>% sqrt %>>% foo(2)
# loses history
16 %>>% sqrt %>>% bar

arendsee avatar Feb 21 '18 15:02 arendsee