[racket] Take an element from a set
Hello,
I'm trying to take an arbitrary item from a set, but I couldn't find a
documented way to do so.
I'd have something like this for example:
> (set-item (set 2 1 3))
3
The best implementation I could come up with for set-item is:
; return one arbitrary item of the set
;
; set -> any/c
(define (set-item s)
(for/first ([item (in-set s)]) item))
Would anyone recommend better ways?
Thanks,
Rodolfo Carvalho
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20110908/63e0c597/attachment.html>