package grenier
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=658e1ad6fc5fdce0871975b3ebcb3ec760248be63cdb9ea965e3121cc7478d77
sha512=d9ff83f1b025f34c22af5921444993df219761dcee8d8cb5a940f266df8677278967434b22314c5c82d5d983e4c94c04cd52c4717d5c1f22fbd3a022631fae1c
doc/grenier.dset/Dset/index.html
Module Dset
Source
A set of abstract elements annotated with values of type 'a
that can be efficiently diffed.
element x
creates a new set element tagged with metadata x
(O(1)). It is the physical identity of the element that is considered when computing set difference, not the tag. Therefore diff (element x) (element x) = { added = [x]; removed = [x]; }
But (let e = element x in diff e e) = { added = []; removed = []; }
Compute the difference between two sets.
diff old_set new_set = { added; removed }
where removed
lists the tag of elements only present in old_set
and added
lists the tag of elements only present in new_set
_Conjecture_: the algorithm is linear in the number of changes between old_set
and new_set
.
When used in a linear fashion (you have a sequence of sets s_i
and only compare s_i
and s_i+1
, at most once for each i
), it should not affect the complexity of the program.