Email list hosting service & mailing list manager

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 John Cowan 25 Dec 2013 03:20 UTC

Alex Shinn scripsit:

> (define (set-intersects? a b)
>   (positive? (set-size (set-intersection a b))))
>
> though it could be implemented much
> more efficiently.

Added.

> 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.

I suppose we could include it for completeness, but there isn't a
natural recursion on sets the way there is on lists; not even a way
to say "remove an arbitrary member of the set and return it".
So `set-empty?` isn't really a base case.  Still, I'll include it.

--
John Cowan  xxxxxx@ccil.org  http://ccil.org/~cowan
And now here I was, in a country where a right to say how the country should
be governed was restricted to six persons in each thousand of its population.
For the nine hundred and ninety-four to express dissatisfaction with the
regnant system and propose to change it, would have made the whole six
shudder as one man, it would have been so disloyal, so dishonorable, such
putrid black treason.  --Mark Twain's Connecticut Yankee