Skip to content
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

Add balanced binary tree based immutable_set implementation #54

Merged
merged 7 commits into from
Mar 18, 2024

Conversation

muqiuhan
Copy link
Contributor

@muqiuhan muqiuhan commented Mar 14, 2024

When creating this PR, I found that the work of immutable_set seems to partially overlap with #53

This PR implements a set data structure without side effects based on a balanced binary tree, this means the add and find value take time logarithmic in the size of the set.

@Yoorkin Yoorkin requested a review from lijunchen March 14, 2024 04:46
@muqiuhan
Copy link
Contributor Author

muqiuhan commented Mar 14, 2024

I think this implementation is a bit confusing and may need to be more concise, I'm trying to refactor it...

@muqiuhan
Copy link
Contributor Author

Now that the tests have passed, we can start to add documentation and tests based on add more functions !

@muqiuhan
Copy link
Contributor Author

I have added the functions required to satisfy the set definition (union, disjoint, subset, diff, inter), we also need general functions such as fold, map, filter etc.

@Yoorkin
Copy link
Collaborator

Yoorkin commented Mar 14, 2024

Is this PR ready now?

@muqiuhan
Copy link
Contributor Author

Is this PR ready now?

Yes, I've done everything I planned and the local tests are passing.

Copy link
Contributor

@lijunchen lijunchen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lijunchen lijunchen merged commit 49d6e7e into moonbitlang:main Mar 18, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants