<div dir="ltr"><div>Hash tables are primitive types, whereas sets aren't, so there's no built-in read syntax for sets. Of course you could always write your own reader for set values, but I recognize that may not be terribly convenient. As for serialize/deserialize, it's not clear to me whether that introduces significant overhead compared to just read/write. On one hand, you do have to allocate the serialized form of the value; on the other, the output itself is likely to be much shorter than the human-readable version, and you will thus save on i/o costs.<br>
</div><div><div><div class="gmail_extra"><br clear="all"><div>Carl Eastlund</div>
<br><div class="gmail_quote">On Sat, Jul 6, 2013 at 1:21 AM, Wayne Iba <span dir="ltr"><<a href="mailto:iba@westmont.edu" target="_blank">iba@westmont.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Thanks, Carl. I'd like to avoid the overhead of serialize/deserialize. I guess I missed that sets were in a different category than hashes with respect to this question. (I was assuming that since I can read in the write of a hash as a hash, I could do the same with sets. Is there a particular reason that's not the case?)<br>
</div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jul 5, 2013 at 1:35 PM, Carl Eastlund <span dir="ltr"><<a href="mailto:cce@ccs.neu.edu" target="_blank">cce@ccs.neu.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div><div>Wayne,<br><br></div>You cannot read in a set. If you read in the result of print, you get '(set 1 2 3), which is a list beginning with the symbol 'set, not a set. Sets are a derived datatype using structs, not a primitive on recognized by read and write. You can use the functions serialize and deserialize to store sets, if you need to.<br>
<br></div>--Carl<br><div class="gmail_extra"><br><div class="gmail_quote"><div><div>On Fri, Jul 5, 2013 at 3:41 PM, Wayne Iba <span dir="ltr"><<a href="mailto:iba@westmont.edu" target="_blank">iba@westmont.edu</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr"><div>If I evaluate (write myset) for myset as (set 1 2 3), the format of
the output is "#<set: 1 2 3>", whereas (print myset) produces
"(set 1 2 3)". Naturally, I can read in the latter but not the former.
From the docs, I believe the expectation is that we can rely on the
output of write for reading, but not necessarily that of print.<br>
<br></div><div>Am I missing something here or is this a problem with how racket is writing sets? (I'm using v5.3.5)<br><br></div><div>Thanks,<br></div>--Wayne<br></div>
<br></div></div>____________________<br>
Racket Users list:<br>
<a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
<br></blockquote></div><br></div></div>
</blockquote></div><br></div>
</div></div><br>____________________<br>
Racket Users list:<br>
<a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
<br></blockquote></div><br></div></div></div></div>