Skip to content

RFC abag<'T> #98

@krauthaufen

Description

@krauthaufen

I'm currently working on abag<'T> in an effort to find some equivalent to seq<'T> for adaptive.

Since order is hard to maintain adaptively (and alist already 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:

  1. I need to create unique-ids for all elements in the bag in order to support removal. The only other alternative I could think of is a reference-counting HashSet where we could count the duplicates (but this would require hashing/etc on elements)
  2. A clean way of using heterogenous keys would be really nice since alist and amap already 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 use obj as key and live with boxing/unboxing in many places

More questions to come but if anyone has ideas/requests or spots problems feel free to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions