-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pipes of functions have broken environments #159
Labels
bug
an unexpected problem or unintended behavior
Comments
Might be a duplicate of #146 but I can't tell |
Noted. It does work in the |
This is not a problem of environment but of lazy evaluation. Forcing the inputs solves the problem: compose <- function(f, g) { force(f); force(g); function(x) g(f(x)) }
plus2 <- plus1 %>% compose(plus1)
plus2(5)
#> [1] 7 See also #195. |
Fixed by #218 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sorry if this appears a little obscure, it's causing me some difficulty.
I found this issue after you posted a review for hedgehog (ta!). Using the pipe I was having infinite recursion due to the environments being brought into functions incorrectly.
Here's a quick bug showing something similar
See above that
f$value
refers tog(f(x))
, when it should befunction(x) x + 1
.The text was updated successfully, but these errors were encountered: