[funds-cvs] r172 - trunk/funds/src
abaine at common-lisp.net
abaine at common-lisp.net
Sun Aug 19 17:34:53 UTC 2007
Author: abaine
Date: Sun Aug 19 13:34:53 2007
New Revision: 172
Modified:
trunk/funds/src/dictionary.lisp
Log:
Added dictionary-as-alist.
Modified: trunk/funds/src/dictionary.lisp
==============================================================================
--- trunk/funds/src/dictionary.lisp (original)
+++ trunk/funds/src/dictionary.lisp Sun Aug 19 13:34:53 2007
@@ -47,3 +47,12 @@
(values nil nil)
(values (cdr pair) t))))
+(defun dictionary-as-alist (d)
+ "An alist containing the same key-value pairs as the given dictionary."
+ (labels ((f (tree)
+ (if (tree-empty-p tree)
+ nil
+ (append (f (bt-left tree))
+ (bt-value tree)
+ (f (bt-right tree))))))
+ (f (dict-tree d))))
More information about the Funds-cvs
mailing list