www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Set ops in std.algorithm

reply bearophile <bearophileHUGS lycos.com> writes:
This post is mostly for Andrei, but I don't think private emails are good for
this.
I suggest to move the set-related functions of std.algorithm to a different
module, because:

1) They are tied to a specific representation of sets (sorted unique
InputRanges), so if I have a BitSet, HashSet, ApproximateBloomSet, etc, they
don't work (they can work with a SearchTreeSet).

2) I think there are too many names/functions in std.algorithm, and their
purpose is a bit too much mixed (and currently algorithm.d module is 173 kB).

I don't know what can be a good name for such new module,
sorted_input_range_set is (I think) descriptive, but a bit too much long :-)

Bye,
bearophile
Mar 10 2010
parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 03/10/2010 05:47 PM, bearophile wrote:
 This post is mostly for Andrei, but I don't think private emails are
 good for this. I suggest to move the set-related functions of
 std.algorithm to a different module, because:

 1) They are tied to a specific representation of sets (sorted unique
 InputRanges), so if I have a BitSet, HashSet, ApproximateBloomSet,
 etc, they don't work (they can work with a SearchTreeSet).

 2) I think there are too many names/functions in std.algorithm, and
 their purpose is a bit too much mixed (and currently algorithm.d
 module is 173 kB).

 I don't know what can be a good name for such new module,
 sorted_input_range_set is (I think) descriptive, but a bit too much
 long :-)

 Bye, bearophile

That's a good idea, particularly in wake of the fact that std.algorithm has grown quite large. Andrei
Mar 13 2010
parent Michel Fortin <michel.fortin michelf.com> writes:
On 2010-03-13 12:02:40 -0500, Andrei Alexandrescu 
<SeeWebsiteForEmail erdani.org> said:

 On 03/10/2010 05:47 PM, bearophile wrote:
 This post is mostly for Andrei, but I don't think private emails are
 good for this. I suggest to move the set-related functions of
 std.algorithm to a different module, because:
 
 1) They are tied to a specific representation of sets (sorted unique
 InputRanges), so if I have a BitSet, HashSet, ApproximateBloomSet,
 etc, they don't work (they can work with a SearchTreeSet).
 
 2) I think there are too many names/functions in std.algorithm, and
 their purpose is a bit too much mixed (and currently algorithm.d
 module is 173 kB).
 
 I don't know what can be a good name for such new module,
 sorted_input_range_set is (I think) descriptive, but a bit too much
 long :-)
 
 Bye, bearophile

That's a good idea, particularly in wake of the fact that std.algorithm has grown quite large.

I think a good module name would be std.sort. You can put the sort function as well as functions related to sorted ranges in it. -- Michel Fortin michel.fortin michelf.com http://michelf.com/
Mar 13 2010