feat(set): add set algebra operations - #19
Open
guiPython wants to merge 4 commits into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
HashSetandKeyedHashSet, including clone, union, intersection, difference, symmetric difference, equality, subset/superset relations, and disjointness.set.Source[T]operand contract so algebra requires only sized iteration, while preserving receiver/factory identity policies, representative semantics, mutation counts, and receiver-alias safety.depguard: packages underinternal/...may use stdlib/external modules, but module-local imports must also remain underinternal/....Issue: N/A
Type Of Change
API And Behavior
Details:
set.Source[T]exposesLengthandAll, allowing algebra operands that do not implement the fullgollections.Collection[T]contract.set.Algebra[T, S]defines pure receiver operations; factories expose equivalent operations over arbitrary sources and return empty sets when called without sources.set.InPlaceAlgebra[T]defines receiver-reusing operations that return the number of memberships changed and support operands that alias the receiver.KeyedHashSetpreserves receiver/first-source representatives except when symmetric difference toggles a later representative into the result.internal/...no longer imports public packages from this module;depguardnow enforces that rule.Testing
go test ./...go test ./internal/set ./setinternal/sethas 100.0% statement coverage.go test -race ./...make lint, if public APIs/docs/broad behavior changed:Paste relevant output or explain why a check was not run:
Risk
internal/..., useslaxmatching, and explicitly allows the longer.../internalprefix while leaving stdlib and external modules unrestricted.Checklist
CONTRIBUTING.mdand checked the relevant project standards when applicable.Notes For Reviewers
set.Source[T]is the right minimal public operand capability and that concrete set operands should continue to be passed as pointers.depguardlaxrule together with the internal shared constraint/collection refactor; the intent is to permit onlyinternal -> internalimports within this module without restricting stdlib or external dependencies.