Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!elroy.jpl.nasa.gov!sdd.hp.com!uakari.primate.wisc.edu!crdgw1!uunet!stanford.edu!lucid.com!campeau!pab From: pab@lucid.com (Peter Benson) Newsgroups: comp.lang.lisp Subject: Re: Hash-table saving Message-ID: Date: 3 May 91 16:33:17 GMT References: <1991May03.092609.16721@kub.nl> Sender: usenet@lucid.com Organization: Lucid, Inc., Boulder, Utah office Lines: 31 In-Reply-To: pberck@kub.nl's message of 3 May 91 09:26:09 GMT There is a hack that works (I think) in lucid common lisp. That is make a file with just (in-package :whatever) (setq *hash-table* '#.*hash-table*) and then compile that file. I don't know if this is required to work by CLtL. Any x3j13 people know if this is clarified. The other alternative is to generate a source file like: (let ((hash-table (make-hash-table))) (dolist (pair '#.(let ((list nil)) (maphash #'(lambda (k v) (push (cons k v) list)) *hash-table*) list)) (setf (gethash (car pair) hash-table) (cdr pair))) (setq *hash-table* hash-table)) and compile that file. This will work as long as the keys and values in the hash table are things that can be put in a compiled file. Depending on how fast the binary file loader is it may be faster than just putting the values in a file. The other advantage is that you don't have to worry about whether all the objects in the hash table print readably. -ptr- pab@lucid.com