-
Notifications
You must be signed in to change notification settings - Fork 272
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
Argument matching in partial() doesn't happen for primitive functions #360
Comments
Primitive functions, like partial(`-`, .y = 5L)
#> function (...)
#> 5L - ... So you have to reverse that: partial(`-`, .y = 5L, .first = FALSE)
#> function (...)
#> ... - 5L |
Thanks for the comment. Yes, I know it and the work around of using map_int(1:10, partial(as_mapper(`-`), .y = 5L)) |
@yutannihilation Then you are right that the documentation is not completely accurate, and maybe even a bit misleading. |
If this is merely a documentation problem, I'm happy to close this issue :) |
It seems we forgot to call |
Are you going to fix this? I'm getting a feeling that this is rather ok with the current behaviour because automatically converting primitives with As the prototype says the arguments are `-`
#> function (e1, e2) .Primitive("-") I guess adding some notes about primitive functions on the documentation of |
Note that those argument names I thought it was a good idea to use |
This is what I didn't know until attempting to match
Oh, sad... |
Binary operators wrapped with |
NEWS on version 0.2.3 says:
If I understand correctly, using
.y
instead of.x
,map(1:10, partial(
-, .y = 5))
, will producelist(1 - 5, 2 - 5, ...)
, right? But it won't:Any argument will produce the same result. What does it mean by "proper argument matching" here? Should I use
as_mapper()
explicitly by myself?The text was updated successfully, but these errors were encountered: