FEAT: implement .all_unique()#241
FEAT: implement .all_unique()#241jswrenn merged 1 commit intorust-itertools:masterfrom samueltardieu:all-unique
Conversation
|
Hi, I have to say I have had problem seeing the value in such a method, but I have also had trouble coming up with examples for how to do this easily with existing iterator and itertools functionality. If we have a collection as starting point we can do the following which many users should be able to find: let all_unique = v.iter().unique().count() == v.len();(So I realized I was wondering if we should instead add methods to the Something like this: let all_unique = collection.iter().unique().all_unique();or even a method that tells us about both the numbers. The fidelity loss is that the let (count_unique, count_dups) = collection.iter().unique().unique_count(); |
|
bors r+ Edit: Looks like bors doesn't like it when the repository underlying a PR is deleted. :( |
In day 4 of the Advent of Code 2017 (https://adventofcode.com/),
all_unique()would have been useful. It is already presentin some languages such as Factor's
all-unique?.