(do ((need (ash size 1) (ash need 1)))
((>= need want) (setf (tree-stack tree) (make-array need)))))))
(do ((need (ash size 1) (ash need 1)))
((>= need want) (setf (tree-stack tree) (make-array need)))))))
(defun getaa (tree key &optional default)
"Look up the given KEY in an Andersson TREE; if the KEY was found, return
the corresponding data and t, otherwise return DEFAULT and nil."
(defun getaa (tree key &optional default)
"Look up the given KEY in an Andersson TREE; if the KEY was found, return
the corresponding data and t, otherwise return DEFAULT and nil."
(cond (node (setf (node-data node) data))
(t (fixup-insert tree stack sp (make-tree-node key data)) data))))
(cond (node (setf (node-data node) data))
(t (fixup-insert tree stack sp (make-tree-node key data)) data))))
(defun updateaa (tree key func)
"Search TREE for an item with the given KEY. If it was found, call FUNC
with arguments of the node's data and t, and store its result as the
(defun updateaa (tree key func)
"Search TREE for an item with the given KEY. If it was found, call FUNC
with arguments of the node's data and t, and store its result as the
(defun remaa (tree key)
"Deletes the node with the given KEY from an Andersson TREE. Returns t if
the node was found and deleted, or nil if it wasn't there to begin with."
(defun remaa (tree key)
"Deletes the node with the given KEY from an Andersson TREE. Returns t if
the node was found and deleted, or nil if it wasn't there to begin with."
(defun aa-tree-iterator (tree)
"Returns a tree iterator function for TREE. The function returns three
values. For each node in the tree, it returns t, the key and the value;
(defun aa-tree-iterator (tree)
"Returns a tree iterator function for TREE. The function returns three
values. For each node in the tree, it returns t, the key and the value;
(defmacro doaa ((key value tree &optional result) &body body)
"Iterate over the items of TREE; for each one, bind KEY to its key and
VALUE to the associated data, and evaluate BODY, which is an implicit
(defmacro doaa ((key value tree &optional result) &body body)
"Iterate over the items of TREE; for each one, bind KEY to its key and
VALUE to the associated data, and evaluate BODY, which is an implicit