From 12ee586a7acb4f0841740a468853d6f73745c19c Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Mon, 21 May 2012 09:35:34 -0500 Subject: [PATCH] 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. --- binary-trees.lisp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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))) -- 1.7.10.4