checking set intersection Alex Shinn (20 Dec 2013 00:25 UTC)
Re: checking set intersection Kevin Wortman (21 Dec 2013 04:45 UTC)
Re: checking set intersection John Cowan (25 Dec 2013 03:21 UTC)
Re: checking set intersection John Cowan (25 Dec 2013 03:20 UTC)

Re: checking set intersection Kevin Wortman 21 Dec 2013 04:45 UTC

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