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

Alex Shinn scripsit:

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

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  cowan@xxxxxxxx  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