Closed lz100 closed 1 year ago
This is actually working as intended, but the way that you can achieve what you want is also documented. On the page you linked, search for “promise_map works serially” and read from there to the end of that section.
Thanks for the info. I missed this part. But it's confusing to achieve such a goal, why would users call an outside function and use strange syntax like .list = .
to do such?
You don't need to use an outside function, you just need a list of promises, and purrr::map
is one concise way to gather up the results of function calls into a list. You could do the same thing with an lapply or for-loop if you want. As for .list = .
, that's pretty idiomatic modern R code but you can do it in a more literal fashion if you want.
Here's a more "base R" way to do it:
promises <- lapply(packages, get_pub_date)
pkg_dates <- promise_all(.list = promises)
Following the tutorial on this page,
promise_map
should work in parallel, but it is not.It is sequential.
If function from
future
is used, then it works.