Author: abaine Date: Tue Jul 10 23:28:15 2007 New Revision: 82
Modified: trunk/funds/src/trees/tree-insert.lisp Log: Factored out side-to-insert function.
Modified: trunk/funds/src/trees/tree-insert.lisp ============================================================================== --- trunk/funds/src/trees/tree-insert.lisp (original) +++ trunk/funds/src/trees/tree-insert.lisp Tue Jul 10 23:28:15 2007 @@ -44,9 +44,7 @@ :value value :left (bt-left tree) :right (bt-right tree)) - (let* ((side (if (funcall order key (bt-key tree)) - :left - :right)) + (let* ((side (side-to-insert tree key :order order)) (other-side (other-side side))) (attach-bt tree side (tree-insert (tree-child tree :side side) key value @@ -62,9 +60,7 @@ :left (bt-left tree) :right (bt-right tree)) (let* ((temp (call-next-method)) - (side (if (funcall order key (bt-key tree)) - :left - :right)) + (side (side-to-insert tree key :order order)) (outside (tree-child temp :side side)) (inside (tree-child temp :side (other-side side)))) (balance inside temp outside :heavy-side side))))