Merged
Conversation
mlemerre
reviewed
Jul 22, 2024
src/signatures.ml
Outdated
| val slow_merge : ('map1, 'map2, 'map3) polymerge -> 'map1 t -> 'map2 t -> 'map3 t | ||
| (** This is the same as {{: https://ocaml.org/api/Map.S.html#VALmerge}Stdlib.Map.S.merge} *) | ||
|
|
||
| val difference: ('a, 'a, 'a) polyinterfilter -> 'a t -> 'a t -> 'a t |
Contributor
There was a problem hiding this comment.
Maybe we should have type 'a difference = ('a,'a,'a) polyinterfilter?
src/signatures.ml
Outdated
| (** This is the same as {{: https://ocaml.org/api/Map.S.html#VALmerge}Stdlib.Map.S.merge} *) | ||
|
|
||
| val difference: ('a, 'a, 'a) polyinterfilter -> 'a t -> 'a t -> 'a t | ||
| (** [difference f map1 map2] returns a map comprising of the bindings |
Contributor
There was a problem hiding this comment.
Maybe name this symmetric_difference? If I understood well what this function does
Collaborator
Author
There was a problem hiding this comment.
Oh yes that's not a bad idea
src/signatures.ml
Outdated
| keys in [m_from], it only updates for keys that are both in [m_from] and | ||
| [m_to]. *) | ||
|
|
||
| val domain_difference: 'a t -> 'b Map2.t -> 'a t |
Contributor
There was a problem hiding this comment.
And this would be just difference
src/functors.ml
Outdated
| let rec domain_difference ta tb = | ||
| match NODE.view ta, NODE.view tb with | ||
| | Empty, _ | _, Empty -> ta | ||
| | Leaf{key;_},_ -> if mem key tb then empty else ta |
Contributor
There was a problem hiding this comment.
Should we use a function on the values to know if we want to remove the binding or not?
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.
Add two difference functions:
domain_difference m1 m2which is justm1restricted to elements that don't appear inm2. On set, this is theStdlib'sdifffunction. Also defined forWithForeignoperations.difference f m1 m2which returns the set of bindings that differ inm1andm2, combining bindings present in both withf.