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))))