
19 Mar
2004
19 Mar
'04
3:44 a.m.
On Wed, 17 Mar 2004, Christian Maeder wrote:
Bags are something between Lists and Sets. Lists become sets by changing "++" to "union" being commutative, associative and idempotent, Lists become only Bags, when idempotency is omitted. Thus the order of elements does not matter as for Sets, but for Bags the multiplicity is important.
Ah! An Abstract Algebra...
So either an implemtation as a "Map elem Int"
or as a sorted list are possible.
Better: ordered balanced trees (easy if you one has abstract balanced trees to reuse). Robert