Created
July 11, 2009 07:35
-
-
Save aethanyc/145152 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(set-macro-character #\} (get-macro-character #\))) | |
(set-macro-character #\{ | |
#'(lambda (stream char) | |
(declare (ignore char)) | |
(let ((plist (read-delimited-list #\} stream)) | |
(hash (gensym))) | |
`(let ((,hash (make-hash-table :test #'equal))) | |
,@(loop for (key value) on plist by #'cddr | |
collect `(setf (gethash ,key ,hash) ,value)) | |
,hash)))) | |
;;; print hash tables | |
(set-pprint-dispatch 'hash-table | |
#'(lambda (stream hash) | |
(format stream "{~{~{~S ~S~}~^, ~}}" | |
(loop for k being the hash-key of hash using (hash-value v) | |
collect (list k v))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment