itertools icon indicating copy to clipboard operation
itertools copied to clipboard

Feature into_group_map_by

Open Sagebati opened this issue 5 years ago • 3 comments

Hi, I'm implementing into_group_map_by which is a function that looks like GroupBy in SQL (although I'm not a fan of the name). I was wondering if the feature was welcome or not. I've also created a function into_group_map_by_fold which would be a version with two closures, one for the key and one for aggregation.

If the feature is welcome I'd like to know what kind of documentation and testing is needed, if you could show me an example.

Edit: The version of minimum of rust is legit ? because I can't compile with rust 1.24.

Sagebati avatar Jan 29 '20 00:01 Sagebati

With into_group_map_by, I think you're trying to solve the problem expressed in #304. Is this correct? There's some relevant discussion there. The consensus was that doing a map before into_group_by offered the most flexibility, but I'm not opposed to adding a convenience method that just chains those two methods behind the scenes.

What parameters does your into_group_map_by take?

jswrenn avatar Jan 31 '20 18:01 jswrenn

The version of minimum of rust is legit ? because I can't compile with rust 1.24.

As of #396, our minimum version is 1.32.

jswrenn avatar Jan 31 '20 18:01 jswrenn

With into_group_map_by, I think you're trying to solve the problem expressed in #304. Is this correct?

Yes it's exactly this problem I'm addressing.

The consensus was that doing a map before into_group_by

It takes only a closure |&T| -> Key but returns an iterator, instead of the HashMap like into_group_map

Sagebati avatar Feb 01 '20 09:02 Sagebati