Thanks for the answer! For now I can go with just having "first", and if needed go for a one/rest approach.
I couldn't find more efficient ways to take "one" though, and with your comment I'm confident to use it as it is now. []'s Rodolfo Carvalho On Thu, Sep 8, 2011 at 00:36, Shriram Krishnamurthi <[email protected]> wrote: > This looks like a reasonable way to get an element, but thinking > ahead, you will probably want something both like "first" (which you > have) and a corresponding "rest". > > The problem is that which element you get from the "first" operation > is nondetermistic in a set. Therefore, you have to either > > - pass the returned first element to the rest operation, or > > - accept that > (set-union (set (set-item S)) (set-rest S)) > is not the same as S > > A better design would be to use a different signature: > > get-one/rest : (forall (A) (Set A) -> (values A (Set A))) > > This performs the split "atomically", so it can ensure that the > combination of "one" and "rest" is the same as the original set. > > Shriram >
_________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users

