[racket-dev] set operations

From: Ryan Culpepper (ryanc at ccs.neu.edu)
Date: Thu Nov 11 15:39:28 EST 2010

I think a function named set-choose should return just the chosen 
element. I would call the function below set-split, maybe.

Also, beware that for/first returns #f if the sequence is empty.


On 11/11/2010 01:38 PM, Jay McCarthy wrote:
> I think it is a good idea. Any objectors?
> Jay
> On Wed, Nov 10, 2010 at 12:40 PM, David Van Horn<dvanhorn at ccs.neu.edu>  wrote:
>> The set library is missing a convenient way of selecting an element from a
>> set, making it hard to write recursive functions matching the inductive
>> structure of a set.
>> Could you add this function, or something like it?
>> (define (set-choose s)
>>   (let ((x (for/first ([x (in-set s)])
>>              x)))
>>     (values x (set-remove s x))))
>> David
>> _________________________________________________
>>   For list-related administrative tasks:
>>   http://lists.racket-lang.org/listinfo/dev

Posted on the dev mailing list.