Re: [racket] Problem writing and reading sets

2013-07-05 Thread Carl Eastlund
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 signi

Re: [racket] Problem writing and reading sets

2013-07-05 Thread Wayne Iba
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

Re: [racket] Problem writing and reading sets

2013-07-05 Thread Carl Eastlund
Wayne, 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

[racket] Problem writing and reading sets

2013-07-05 Thread Wayne Iba
If I evaluate (write myset) for myset as (set 1 2 3), the format of the output is "#", 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 nece