A little Go => Python story
bearophile
bearophileHUGS at lycos.com
Tue Apr 23 16:58:53 PDT 2013
Luís Marques:
> The only one that seems "easy" to solve in D is adding sets, no?
Considering the troubles given by the built-in D associative
arrays, and the possibility to write good enough set literals
like:
auto s1 = set([1, 10, 5]); // helper function.
Set!int items = iota(2, 11)
.map!(x => x % 10)
.set;
Then I think it's enough to add a Set!T in std.collections with
the nice semantics of the Python sets, plus the set() helper.
Here the only limit is that D uses opCmp for all its comparisons,
so some of the operators of the Python sets can't be defined, and
they need to be only normal methods for the Set!T. I am not
worried.
Bye,
bearophile
More information about the Digitalmars-d
mailing list