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

Merge pull request #411 from dfinity/ggreif/update-moc-0.7.0 #412

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

fury02
Copy link

@fury02 fury02 commented Aug 27, 2022

Update moc to 0.7.0

The put; delete functions do not work; (TrieSet)
I made a correction by referring directly to the Trie.
Look maybe these are all the fixes that are needed

@ghost
Copy link

ghost commented Aug 27, 2022

Dear @fury02,

In order to potentially merge your code in this open-source repository and therefore proceed with your contribution, we need to have your approval on DFINITY's CLA1.

If you decide to agree with it, please visit this issue and read the instructions there.

— The DFINITY Foundation

Footnotes

  1. Contributor License Agreement

@ghost ghost added the cla:pending label Aug 27, 2022
src/TrieSet.mo Outdated
@@ -26,14 +26,18 @@ module {

/// Put an element into the set.
public func put<T>(s : Set<T>, x : T, xh : Hash, eq : (T, T) -> Bool) : Set<T> {
let (s2, _) = Trie.put<T,()>(s, { key = x; hash = xh }, eq, ());
s2
// let (s2, _) = Trie.put<T,()>(s, { key = x; hash = xh }, eq, ());
Copy link
Contributor

Choose a reason for hiding this comment

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

feel free to remove old code, this obscures the real changes in the PR's diff

src/TrieSet.mo Outdated
s2
// let (s2, _) = Trie.remove<T, ()>(s, { key = x; hash = xh }, eq);
// s2
s := Trie.remove<T, ()>(s, { key = x; hash = xh}, eq).0;
Copy link
Contributor

@ggreif ggreif Aug 27, 2022

Choose a reason for hiding this comment

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

Does this even compile? Function parameters are supposed to be immutable.

Copy link
Author

@fury02 fury02 Aug 28, 2022

Choose a reason for hiding this comment

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

Fixed. Recommendations have also been adopted.

@fury02
Copy link
Author

fury02 commented Aug 28, 2022

I'm sorry, checking fixed it
The generic type 'T' must be defined by the type at the time of use
Fixed for the version that is being compiled.

Using (T -> type Nat)

my_trie_set := TrieSet.put(my_trie_set, 1, Nat.hash, Nat.equal)

@ggreif ggreif force-pushed the master branch 3 times, most recently from d52aecd to 08507fc Compare October 21, 2022 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants