-
Notifications
You must be signed in to change notification settings - Fork 42
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
NamePermutationIterator #143
Conversation
…are possible That way we have a natural bound on complexity that still suits reality well.
We know it's not going to be too many.
Great work, thank you! I have adjusted the structure and streamlined the tests a little. While playing with the tests I noticed that it prefers I happen to have a database available with all available 121k crate names. The tally of
Thus To understand better of what we are dealing with in terms of max-permutations, I counted the highest amount of Please find the original data here if you want to poke at it yourself (importing to SQLite while asking ChatGPT for queries works neatly): crate.csv.zip Further, I think the first name produced should always be the input itself - I gave it a shot, please take a look. Maybe you have a smarter way of doing it - this way is quite acceptable performance wise as it makes the iterator 10% slower, and that's in the cards after making it nearly twice as fast.
It's can't be an iterator anymore then, as lending iterators aren't supported with Rust's current borrow checker, unfortunately. Otherwise, definitely, but without that I think it's preferable to have it allocate for better usability. The alternative would be to hand in |
If you want, you could contribute an example for |
I thought about that and then quickly forgot it again...
do you mean simply adding a another possible optimation could be to prefer all |
Yes, that would do, but that's just one of many ideas to indicate the flexibility that comes with it. Also to clarify, I meant that the contribution could either be a doc-test or maybe even an adjustment of one of the existing examples as long as there is user input.
Definitely! That would be even better to have as these would be the most likely anyway. Ideally, we would then have the sequence Thinking about it, you could also implement the |
This PR adds the in #75 suggested
NamesIter
open Questions:
-_
?In case of more than 32 separators, the programs would just crash with an
attempt to multiply with overflow
.I don't think handling it as a
Result<>
would be reasonable as this case is not realistic and usingResult<>
would make the API worse (at least in my opinion)&str
?note:
I am not really happy with the code but every attempt of improving it just made it worse...