[racket-dev] set operations

From: David Van Horn (dvanhorn at ccs.neu.edu)
Date: Wed Nov 10 14:40:21 EST 2010

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


Posted on the dev mailing list.