[funds-cvs] r28 - trunk/funds/src/trees
abaine at common-lisp.net
abaine at common-lisp.net
Wed Jun 20 16:27:21 UTC 2007
Author: abaine
Date: Wed Jun 20 12:27:20 2007
New Revision: 28
Modified:
trunk/funds/src/trees/avl-tree.lisp
Log:
Changed avl-insert signature to accept keyword arguments test and order
Modified: trunk/funds/src/trees/avl-tree.lisp
==============================================================================
--- trunk/funds/src/trees/avl-tree.lisp (original)
+++ trunk/funds/src/trees/avl-tree.lisp Wed Jun 20 12:27:20 2007
@@ -17,13 +17,19 @@
t if it is empty; nil else."
(null tree))
-(defun avl-insert (tree key value)
+(defun avl-insert (tree key value &key (test #'eql) (order #'<))
(cond ((avl-empty-p tree) (make-avl :ht 1
:key key
:value value
- :left nil
- :right nil))
- ((< key (avl-key tree)) (left-insert tree key value))
+ :left (empty-avl-tree)
+ :right (empty-avl-tree)))
+
+ ((funcall test key (avl-key tree)) (make-avl :ht (avl-ht tree)
+ :key key
+ :value value
+ :left (avl-left tree)
+ :right (avl-right tree)))
+ ((funcall order key (avl-key tree)) (left-insert tree key value))
(t (right-insert tree key value))))
(defun left-insert (tree key value)
More information about the Funds-cvs
mailing list