Re: [racket-dev] set operations

2010-11-11 Thread Neil Toronto
I've written a version of `set-choose', and also `set-first' and `set-rest' (with the obvious meanings) a few times. They can be useful. (I always waffled about whether to use just `set-choose', or `set-first' along with `set-rest'. Mathematically, `set-first' and `set-rest' don't make sense,

Re: [racket-dev] set operations

2010-11-11 Thread Ryan Culpepper
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. Ryan On 11/11/2010 01:38 PM, Jay McCarthy wrote: I think it is a good idea. Any objectors? Jay On Wed

Re: [racket-dev] set operations

2010-11-11 Thread Jay McCarthy
I think it is a good idea. Any objectors? Jay On Wed, Nov 10, 2010 at 12:40 PM, David Van Horn 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 thi

[racket-dev] set operations

2010-11-10 Thread David Van Horn
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