Re: A simple sieve in Phobos?

2014-03-19 Thread Dan Killebrew
On Wednesday, 19 March 2014 at 01:29:16 UTC, bearophile wrote: I suggest a Phobos module named "combinatorics" (or just "combs"?). It's not meant to be a complete library of combinatorics algorithms, nor to contain the most optimized algorithms around. It's meant to be a collection of efficien

Re: How to make a global immutable associative array?

2014-03-18 Thread Dan Killebrew
On Wednesday, 19 March 2014 at 00:37:27 UTC, bearophile wrote: Dan Killebrew: Seems unintuitive and roundabout. Is this a bug or a feature? It's a good feature. Generally immutable variables are initializable from strongly pure functions. If you think about what immutability and p

Re: A simple sieve in Phobos?

2014-03-18 Thread Dan Killebrew
On Tuesday, 18 March 2014 at 15:54:23 UTC, Andrea Fontana wrote: I can't understand whether or not this is a sieve of atkin... The link says 'A very quick (segmented) sieve of Eratosthenes'

Re: How to make a global immutable associative array?

2014-03-18 Thread Dan Killebrew
You just have to construct it first and then claim that it is unique and so safely cast it to immutable: import std.exception : assumeUnique; immutable int[int] aa; static this(){ auto temp = [1:2, 3:4]; aa = assumeUnique(temp); } Seems unintuitive and roundabout. Is this a bug or a f