[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: checking set intersection
- To: srfi-113@xxxxxxxxxxxxxxxxx
- Subject: Re: checking set intersection
- From: Kevin Wortman <kwortman@xxxxxxxxx>
- Date: Fri, 20 Dec 2013 20:45:06 -0800
- Delivered-to: srfi-113@xxxxxxxxxxxxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=kkp2QeeNk7YOPLX6ORXYnbKb63k6VtNAt5mLoD06LHg=; b=LY+yD+0SERFWyBdzVHWlgH9jwlSPKNKwA/ZzWpc37zphe5Tq0IuWWNJgRN1I/He3u5 n3UQCcDW4MFnbuA2He6WhKgAcDfRGVoX3Vd2emz+85Fbr+mVDd/5BgLvkV/qX+6NeOY4 BVj3DMwjJfFmlHyv9efKKa1HJ3d5fTIMAvsVpoDJzIm6iHRywkMdk6ZvzWxzAUNpsvaR K0vCkbglhTEeofxEcsdFBXHF2DRVj7simsr3ZkZC6UPFq9BA2b+XOp0yXgeGSbuFyXzG SaPmlnqGN29VrmT9v49COzR157a5OHIrYy5p/+OSdoYLgAKuvQy29ICr1GnsRP25mobo 3SYQ==
- In-reply-to: <CAMMPzYOPJEbsSe6vdQZa1=5Lu6oKoPtSxzdWV_KaN-HpikyPwA@mail.gmail.com>
- References: <CAMMPzYOPJEbsSe6vdQZa1=5Lu6oKoPtSxzdWV_KaN-HpikyPwA@mail.gmail.com>
- User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0
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.