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
permutations and combinations don't have a :distinct parameter #5958
Comments
From @mschaThe permutations and combinations routines both give all possibilities,
If you want distinct permutations or combinations, you have to do
This is not ideal. It would be awesome if we could do something like:
(This potentially has better performance too, depending on the |
From @zoffixznetOn Sat, 31 Dec 2016 18:59:43 -0800, perl6@mscha.org wrote:
To me this feels like opening a can of worms. For example, I assume you propose `:distinct` to use `eqv` for comparison, but that would mean <4> (the allomorph) and 4 (the Int) are different items and I can definitely see how some would wish for those to compare the same. We can make it take a comparator, but then we're saving just 8 characters of extra typing in a feature that's not used so commonly as to make those 8 extra chars a bother to type.
Do you have suggestions for implementations that'd offer that? Both `.permutations` and `.unique` use lazy sequences, so `.permutations.unique[^5]` would generate just enough items to produce a list of 5. In fact, the most obvious way to implement `:distinct` is by returning a `:distinct`-less `.permutations` Seq with `.unique` call slapped on it. -1 from me on this addition. YAGNI: You Ain't Gonna Need It |
The RT System itself - Status changed from 'new' to 'open' |
From @mschaOn 1-Jan-17 7:16, Zoffix Znet via RT wrote:
I can't really judge whether this would be used commonly. I just
|
Migrated from rt.perl.org#130472 (status was 'open')
Searchable as RT130472$
The text was updated successfully, but these errors were encountered: