RFC abag<'T>
#99
Replies: 2 comments
-
|
I believe that bag is the standard way of naming a collection without any constraints (uniqueness, order, though it makes removal problematic) 👍 |
Beta Was this translation helpful? Give feedback.
-
|
Hey, you're conceptually right of course and implementations for Furthermore the set-semantics is also more tricky than one might think at a first glance. Especially when operations like Of course all combinators could be implemented on specialized amaps but that would not really make things simpler. Also the list-structures keep ordered representations internally and therefore don't need to be sorted externally. While I think your argument is totally valid from a theoretical point-of-view I believe having separate data structures for list, set, map and maybe bag is the "sane" thing to do. Of course from a database perspective amap might be the only interesting thing, but adaptive is also used in rendering applications and UI programming where sets/lists play a much larger role. Also FSharp.Core itself goes this way via |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm currently working on
abag<'T>in an effort to find some equivalent toseq<'T>for adaptive.Since order is hard to maintain adaptively (and
alistalready does that) we need some sort of unordered collection that does not care about duplicate elements (nor hash anything). I coined the term bag but I'm not entirely happy with it, so suggestions would be very welcome.I implemented all the basic combinators I could come up with here and the current implementation gives rise to a few questions:
alistandamapalready contain unique-identifiers for each element but constantly boxing/unboxig all keys could be costly. So either cache unique-ids for each input-key (Index/amap-key) or useobjas key and live with boxing/unboxing in many placesMore questions to come but if anyone has ideas/requests or spots problems feel free to comment
Beta Was this translation helpful? Give feedback.
All reactions