[plt-scheme] Is there a set data-type?

From: hendrik at topoi.pooq.com (hendrik at topoi.pooq.com)
Date: Fri Feb 5 12:17:20 EST 2010

On Fri, Feb 05, 2010 at 03:54:13PM +0000, Paulo J. Matos wrote:
> David Van Horn wrote:
> >
> >Uh, how do you represent the set of all even numbers, for example?
> >
> >This is an exercise we give our first semester undergraduates here at 
> >Northeastern.  I'll give you a hint: you don't need lists or hash 
> >tables, go back to the mathematical foundations and think characteristic 
> >functions.
> >
> >Now you do union, intersection, setminus, etc.
> >
> 
> Good example... in fact, I didn't even thought about it when I 
> implemented this... ahah Funny. Thanks for the counterexample.
> 
> I guess the characteristic function approach involves using lambdas to 
> represent a set... :-/ I am worried with efficiency but I will give it a 
> try.

To do sets properly, you'd want the be able to enumerate the elements as 
well as have a characteristic function.  That can be done, of course, 
for enumerable sets, anyway.

-- hendrik

> 
> >David
> >_________________________________________________
> > For list-related administrative tasks:
> > http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> 
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme


Posted on the users mailing list.