Hello. I need to generate values and collect them recursively without keeping duplicated values. I have tried using elpi's implementation of sets. The sets from recursive calls to my predicate are merged into the output set. However, using the
std.set.private.merge predicate for the merger does not actually remove the duplicates. Could it come from the fact that it is a set of terms I am generating, and that I am using
cmp_term to build the sets? Thanks for the help!
I'm a bit confused, you should not call
std.set.private.merge since it is private. The
set library misses the union API, which is embarassing... you can either fold
add or implement it adapting the ocaml code as I did for the rest of the set library, see https://github.com/ocaml/ocaml/blob/trunk/stdlib/set.ml#L267 (as you can see merge is not union, but rather an internal auxiliary function)
I see. I think I'll go with the first solution, a.k.a. using the public API only and folding
add for now. Thank you!
Last updated: Jun 06 2023 at 22:01 UTC