Function: avl-tree-enter
avl-tree-enter is a byte-compiled function defined in avl-tree.el.gz.
Signature
(avl-tree-enter TREE DATA &optional UPDATEFUN)
Documentation
Insert DATA into the AVL tree TREE.
If an element that matches DATA (according to the tree's
comparison function, see avl-tree-create) already exists in
TREE, it will be replaced by DATA by default.
If UPDATEFUN is supplied and an element matching DATA already exists in TREE, UPDATEFUN is called with two arguments: DATA, and the matching element. Its return value replaces the existing element. This value *must* itself match DATA (and hence the pre-existing data), or an error will occur.
Returns the new data.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/avl-tree.el.gz
(defun avl-tree-enter (tree data &optional updatefun)
"Insert DATA into the AVL tree TREE.
If an element that matches DATA (according to the tree's
comparison function, see `avl-tree-create') already exists in
TREE, it will be replaced by DATA by default.
If UPDATEFUN is supplied and an element matching DATA already
exists in TREE, UPDATEFUN is called with two arguments: DATA, and
the matching element. Its return value replaces the existing
element. This value *must* itself match DATA (and hence the
pre-existing data), or an error will occur.
Returns the new data."
(cdr (avl-tree--do-enter (avl-tree--cmpfun tree)
(avl-tree--dummyroot tree)
0 data updatefun)))