A simple sieve in Phobos?
bearophile
bearophileHUGS at lycos.com
Sun Mar 30 17:55:24 PDT 2014
safety0ff:
> I.E. Are there non-toy uses to support inclusion?
I have several non-toy uses for the GCD, binomial, and the
permutations/combinations/pairwise ranges.
The other little discrete numerical functions like the integer
square root, etc, are useful sufficiently often.
The other two (isPrime and a sieve) are less practical, so their
inclusion is more debatable. Sometimes you want some small primes
for hashing, or in the unittests of a Rational type, and few
other situations. But D is for mathematics usage too. Given the
commonality of prime numbers in discrete mathematics (example: if
you want to study certain graphs), I think such two/three
functions/generators are acceptable, if they aren't too much
complex.
Bye,
bearophile
More information about the Digitalmars-d
mailing list