[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Updated issues list for SRFI 113



On Sun, Jun 2, 2013 at 1:17 PM, Per Bothner <per@xxxxxxxxxxx> wrote:
 
Examples and use cases?

Counting anything from a fixed set of possibilities, e.g. the number of each type of error in a log file or the number of uses of each word in a lexicon in a body of documents.  It's a special case of other data structures, e.g. hash tables mapping items to integers, but it's good to have because it clearly expresses the programmer's intent and can be optimized.  Sets, after all, are just maps from items to arbitrary values, but they're still useful to have.
 
I'm surprised because in many years of implementing and using
complex data structures I can't recall any time where I've wanted bags.

Aha, it's because you've been using complex data structures!  This one is super simple, but it does capture common patterns.

If you add bags, a 'for-each-unique-element' procedure seems
essential - otherwise there seems to be absolutely no point.

You're right.  There should also be a bag-unique-elements function, which returns the set of unique elements present in the particular bag.

John, have you already done one of your comprehensive surveys of existing implementations?  I'd love to compare the proposal to what's already available.