[plt-scheme] Reading/writing hash-tables

From: Ethan Herdrick (info at reatlas.com)
Date: Wed Oct 31 00:05:03 EDT 2007

What you need is a hash table literal and we don't have that,
unfortunately.  What I do (I think it's the usual thing to do) is use
hash-table->alist and then write that.  There's alist->hash-table for
reading it back in, of course.  Works great.

On 10/30/07, David Van Horn <dvanhorn at cs.brandeis.edu> wrote:
> If I write a hash table, like this:
>
>     (write #hash((f . (10))))
>
> Then #hash((f 10)) is written on the current port, but I can't read this
> back in since the reader complains:
>
>     read: expected `.' and value for hash
>
> Is this intended?  Can either the reader or writer be changed so I can
> read and write hash tables?
>
> Thanks,
> David
>
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>


Posted on the users mailing list.