开发者

Write/read a Common Lisp (SBCL) hash-table, or alternative

I would like to write/read a hash-table to/from disk, but it is not a (print)able object. I won't know the key names so I can't think of a way to do it manually. I read that there might be distribution-specific ways to do this; is there anything for this in SBCL?

I didn't find anything in the SBCL manual or on Google.

If not, is ther开发者_开发知识库e another, storable way to keep lists of integers bound to strings, be able to modify those lists efficiently, and have constant or at least faster-than-alist access time?

Are binary search trees easy enough to implement with alists and is that a good idea for making a basic database?


MAPHASH maps a function with two arguments over a hash table for side effects. The two arguments are the key and value of each item in the hash table. You can use this to for example write each item in the hash table as a list of the key and value:

(maphash (lambda (key value)(write (list key value))) *hash-table*)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜