GroupMap: add fold_with#778
Conversation
|
I'm not in favor of a breaking change without good reason. Plus, add |
|
If we accept this, I'd second @Philippe-Cholet's proposal and implement |
|
Done. |
|
I think I'm wondering if |
|
Done. The example is a bit contrived, let me know if you have a specific suggestion please. |
|
I did not thought of anything and |
|
That doesn't seem very compelling; such code would still compile albiet with slightly worse performance. I would prefer to demonstrate a use case that can't be written using |
|
For such small example, it sure is not very compelling. |
|
Done. |
|
@phimuemue What do you think of this |
|
As for the test, I'm fine with the copy-paste (it's a specific test meant to test one thing only, and the danger that these two tests diverge seems low). I first thought that I'm fine with it API wise (it's in line with other |
|
I did not thought of that, it would definitely be more general. I'm wondering what would be the use case though, especially having
But with the simple I would keep the doctest example simple though with |
|
I did write this with a key parameter at first, but then realized the result is almost the same as I ended up using |
|
@Philippe-Cholet @phimuemue did you want this to take |
Since you already cooked up a version involving I agree the function is very similar to |
|
Sorry for the late response, I took a little break.
Maybe it's because I'm not very familiar with Otherwise agree with phimuemue. |
This is a generalization of `fold` which takes a function rather than a value, which removes the need for a `Clone` bound. `fold` is implemented in terms of `fold_with`.
|
Done. |
|
Thank you. I'll merge this and make the closure accept |
This is a generalization of
foldwhich takes a function rather than a value, which removes the need for aClonebound.foldis implemented in terms offold_with.