Solomon Foster wrote: > Well, hyperoperators work fine on Hashes, they operate on the values, > paired up by key if needed. (That is, %hash>>++ doesn't care about > the keys, %hash1 >>+<< %hash2 sums based on keys.) I would assume > that Bag should work in the exact same way. Dunno how Set should work > in this context, though.
I would hope that Bags would not work the same way. If they do, then you get things like: Bag(1, 3, 2, 1) >>+<< Bag(2, 3, 1, 2) # same as Bag(1, 1, 1, 2, 2, 2, 3, 3) I'm not sure how (or even if) Bags _should_ work in this context; but the above is definitely not what I'd expect. IMHO, a key point about Bags and Sets (no pun intended) is that the values of the elements _are_ the keys; the existence of separate values (unsigned integers in the case of Bags; booleans in the case of Sets) are - or should be - mostly a bookkeeping tool that rarely shows itself. Incidently, we might want to set up a role to define the shared behavior or Bags, Sets, et al. My gut instinct would be to call it "Baggy"; "Setty" would make the stargazers happy, but otherwise wouldn't mean much. With this, you could do things like creating a FuzzySet that stores a number between zero and one for each key, but which otherwise behaves like a Set. -- Jonathan "Dataweaver" Lang