[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: checking set intersection

This page is part of the web mail archives of SRFI 113 from before July 7th, 2015. The new archives for SRFI 113 contain all messages, not just those from before July 7th, 2015.

On 12/19/2013 04:25 PM, Alex Shinn wrote:
> I've had uses for testing whether two sets
> intersect without needing the actual
> intersection, so I think the following would
> be useful:
> (define (set-intersects? a b)
>   (positive? (set-size (set-intersection a b))))
> though it could be implemented much
> more efficiently.
> I was originally going to write this as
>   (not (set-empty? ...))
> but realized there was no such predicate.
> We might want to include that as well.

This is a good point and I second the request for set-intersects? and
set-empty?. Both should be easy enough to implement.

We already have predicates for set equality, subsets, proper subsets,
and are now discussing intersection. We might as well add a
set-disjoint? predicate too so that all the fundamental set
relationships are represented.

Kevin Wortman