[funds-cvs] r172 - trunk/funds/src

19 Aug
2007
19 Aug
'07
5:34 p.m.
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))))
6528
Age (days ago)
6528
Last active (days ago)
0 comments
1 participants
participants (1)
-
abaine@common-lisp.net