-
Notifications
You must be signed in to change notification settings - Fork 2
support sets #9
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
base: master
Are you sure you want to change the base?
support sets #9
Conversation
condiderations: - this implementation clashes a bit with - current implementation follows rest of the convention in the lib, could instead/also expose methods on the generic Set type
|
Not against it, For performance reasons the setz package seems resonable, supporting mutations. But is the bool vs struct that much different or it the reason looking for eg effective Intersection, Difference and so on operations? If so, that might be a good reason to add them on a key level on in |
| } | ||
|
|
||
| func Union[A comparable](set1 Set[A], set2 Set[A]) Set[A] { | ||
| set := make(Set[A]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably should guess a size here, at least max(len(set1), len(set2))
| } | ||
|
|
||
| func Intersection[A comparable](set1 Set[A], set2 Set[A]) Set[A] { | ||
| set := make(Set[A]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably should guess a size here, at least min(len(set1), len(set2))
| } | ||
|
|
||
| func Difference[A comparable](set1 Set[A], set2 Set[A]) Set[A] { | ||
| set := make(Set[A]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably should guess a size here, at least max(len(set1), len(set2))?
considerations:
slicez.Set()