[m-rev.] predicate name needed

Peter Wang novalazy at gmail.com
Tue Dec 23 10:55:40 AEDT 2014


On Tue, 23 Dec 2014 10:24:02 +1100, Ian MacLarty <imaclarty at opturion.com> wrote:
> On Mon, Dec 22, 2014 at 6:26 PM, Zoltan Somogyi <zoltan.somogyi at runbox.com>
> wrote:
> 
> > I would like to add a predicate to all the modules in the library
> > that implement sets, but I cannot think of a good name for it.
> > Here is the description of what I intend it to do:
> >
> > +    % compare_sets(SetA, SetB, OnlyInA, InAandB, OnlyInB):
> > +    % Given SetA and SetB, return the elements that occur only in one set,
> > +    % and the elements that occur in both.
> > +    %
> > +    % XXX better name? symmetric_difference would work for OnlyInX, but
> > +    % not for InAandB.
> > +    %
> > +:- pred compare_sets(set(T)::in, set(T)::in,
> > +    set(T)::out, set(T)::out, set(T)::out) is det.
> >
> > Any ideas for a good name? set_intersection_and_differences
> > would self-explanatory enough, but it is long. sets_venn_diagram
> > would imply the presence of graphics for some people.
> >
> >
> Some ideas: "coverage", "regions", "interference".

partition_by_membership?

intersection_and_differences is straightforward, though I suggest the
argument order:  intersection_and_differences(A, B, A/\B, A\B, B\A)

Peter



More information about the reviews mailing list