From: Ryan Pavlik Date: Mon, 21 May 2012 14:35:34 +0000 (-0500) Subject: FIND now returns the NODE-KEY rather than the passed ITEM-KEY. X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=12ee586a7acb4f0841740a468853d6f73745c19c;p=trees.git FIND now returns the NODE-KEY rather than the passed ITEM-KEY. This means attached data can be modified without doing an additional search, if the specified item is not inserted due to an existing key. Whether the new key or old key is used is already a function of the second return value. --- diff --git a/binary-trees.lisp b/binary-trees.lisp index bccc1b6..46351f7 100644 --- a/binary-trees.lisp +++ b/binary-trees.lisp @@ -57,7 +57,7 @@ (let ((node-key (funcall key (datum node)))) (cond ((funcall test node-key item-key) - (return-from find-insertion-point (values node direction-stack item-key))) + (return-from find-insertion-point (values node direction-stack node-key))) ((funcall pred item-key node-key) (push (cons node 'left) direction-stack) (setf node (left node)))