Skip to content

Efficient set operations for @immut/hash{map, set} #1830

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
waterlens opened this issue Mar 25, 2025 · 4 comments · May be fixed by #2145
Open

Efficient set operations for @immut/hash{map, set} #1830

waterlens opened this issue Mar 25, 2025 · 4 comments · May be fixed by #2145

Comments

@waterlens
Copy link
Collaborator

There should be the following set operations on @immut/hash{map, set}:

// T is either T[K, V] or T[K]
fn intersection(T, T) -> T
fn union(T, T) -> T
fn difference(T, T) -> T
// only in hashmap for customed conflict resolution function
fn intersection_with(T, T, (V, V) -> V) -> T
fn union_with(T, T, (V, V) -> V) -> T

This clojure library might be a good reference:
https://github.com/cnuernber/ham-fisted

@Lampese
Copy link
Collaborator

Lampese commented Mar 27, 2025

What about mutable hash{map,set}, mutable sorted{map,set}, @immut/sorted_{map, set}?

@waterlens
Copy link
Collaborator Author

Leave space for other contributors :)

@Lampese
Copy link
Collaborator

Lampese commented Mar 27, 2025

Leave space for other contributors :)

If this API is necessary, we need to open another issue to mark it and avoid forgetting.

@waterlens
Copy link
Collaborator Author

Leave space for other contributors :)

If this API is necessary, we need to open another issue to mark it and avoid forgetting.

Maybe we can leave this issue open?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants