Thanks for the answer!<div><br></div><div>For now I can go with just having "first", and if needed go for a one/rest approach.</div><div><br></div><div>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.</div>
<div><br></div><div>[]'s</div><div><br></div><div>Rodolfo Carvalho</div><div><br><div><br></div><div><div class="gmail_quote">On Thu, Sep 8, 2011 at 00:36, Shriram Krishnamurthi <span dir="ltr"><<a href="mailto:sk@cs.brown.edu">sk@cs.brown.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">This looks like a reasonable way to get an element, but thinking<br>
ahead, you will probably want something both like "first" (which you<br>
have) and a corresponding "rest".<br>
<br>
The problem is that which element you get from the "first" operation<br>
is nondetermistic in a set. Therefore, you have to either<br>
<br>
- pass the returned first element to the rest operation, or<br>
<br>
- accept that<br>
(set-union (set (set-item S)) (set-rest S))<br>
is not the same as S<br>
<br>
A better design would be to use a different signature:<br>
<br>
get-one/rest : (forall (A) (Set A) -> (values A (Set A)))<br>
<br>
This performs the split "atomically", so it can ensure that the<br>
combination of "one" and "rest" is the same as the original set.<br>
<font color="#888888"><br>
Shriram<br>
</font></blockquote></div><br></div></div>