-
Notifications
You must be signed in to change notification settings - Fork 18
Description
I've been working on trying to write some additional documentation for this module (here). This module already has great detail on the parts, but I was thinking it would be really nice if it also had something like the std::collections introduction:
To get this out of the way: you should probably just use
VecorHashMap. These two collections cover most use cases for generic data storage and processing.
std::collections has lots of classes for niche cases, but really, if you only ever look at those two, you'll probably be fine.
Similarly, it would be nice if this module had something similar. Primes covers many cases, but not is_prime or factor. I was thinking of perhaps adding two usability features to Sieve: the first a new_with_n function, and the second an iterator over all primes in Sieve (perhaps an iter() function, or maybe just an IntoIterator implementation). That way, the introductory material can direct people to Sieve for any case where they know how many primes they need, or to Primes if not. I've started work on that here, and would like to know what you think.
Another possibility would be to implement an auto-expanding sieve, that can both go on to infinity (like Primes), but also still "remember" enough to be able to factorize numbers or check primality. Is there a way to do that with Sieve and StreamingSieve?