-
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
Implement map_vec()
#683
Implement map_vec()
#683
Conversation
A few questions:
|
Other things vctrs can help with:
|
Last time we talked about this with Hadley, the idea was to have Similarly, Does this suggest we should have |
I see that mention of I am a bit worried about performance here. If purrr was being implemented from scratch today, I feel like a C version of I do think generally |
Thought: How can we compute the prototype of the output in advance if we need all elements of the output to determine the common type? Unless, |
Superseded by #894 |
This PR implements
map_vec()
, a vctrs poweredmap()
that attempts to simplify the output automatically by computing the common type of the result elements. If a common type can be found, the result will be simplified to that type. If not, a list is returned.This is a draft PR for now as I'm not currently proposing that it be merged. I'd like to get feedback and see what others think about it.
This function maintains the invariant that:
After glancing at the issues, it seems this PR touches: #679, #633, #472, #376
For now, here are a number of examples that demonstrate the features of
map_vec()
: