-
Notifications
You must be signed in to change notification settings - Fork 276
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
Should map functions also work on environments? #135
Comments
that would be nice for expensive computations. It would enable us to recover the results on user interruption or when an error occured. But for this use case we can't rely on the coercion-to-list trick. |
Then we can have Edit: Should it take |
I'd want this to be idempotent, so it would either fail or succeed as a whole (i.e. it would alway create a new vector). We can currently handle errors with |
That would be nice. This is useful when doing simulations to check if we need more or if we already have enough to perform reasonable inferences. Regarding the caveats you mention, we could provide separate functions such as |
otoh that may be a lot of work just to avoid a for loop. Im' thinking about this kind of pattern: try_map(seq_len(nsims), draw_simulation) |
Could it be Edit: The map part would come from |
@lionel- isn't that essentially |
hmm yes, a standard evaluation version of Or do you feel it's too redundant? We could have both |
Re-reading this discussion I think we were slightly talking past each other. It seems like there's maybe to useful forms for mapping an environment:
The second seems sufficiently different to the rest of the map functions to be worth a different name. It may also be more appropriate in rlang than purrr since it's no longer to do with vectors. |
I'm going to close this since it feels a bit out of scope for purrr (which is mostly about lists/vectors). It also just occurred to me that |
And perhaps |
Would either have to coerce to a list (which should be fairly cheap because only makes a shallow copy, but then the user could do that explicitly), or rewrite
map_impl
to use index by name rather than position (which would be a reasonable amount of work for a special case).The text was updated successfully, but these errors were encountered: