Function: avl-tree-delete

avl-tree-delete is a byte-compiled function defined in avl-tree.el.gz.

Signature

(avl-tree-delete TREE DATA &optional TEST NILFLAG)

Documentation

Delete the element matching DATA from the AVL TREE.

Matching uses the comparison function previously specified in avl-tree-create when TREE was created.

Returns the deleted element, or nil if no matching element was found.

Optional argument NILFLAG specifies a value to return instead of nil if nothing was deleted, so that this case can be distinguished from the case of a successfully deleted null element.

If supplied, TEST specifies a test that a matching element must pass before it is deleted. If a matching element is found, it is passed as an argument to TEST, and is deleted only if the return value is non-nil.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/avl-tree.el.gz
(defun avl-tree-delete (tree data &optional test nilflag)
  "Delete the element matching DATA from the AVL TREE.
Matching uses the comparison function previously specified in
`avl-tree-create' when TREE was created.

Returns the deleted element, or nil if no matching element was
found.

Optional argument NILFLAG specifies a value to return instead of
nil if nothing was deleted, so that this case can be
distinguished from the case of a successfully deleted null
element.

If supplied, TEST specifies a test that a matching element must
pass before it is deleted.  If a matching element is found, it is
passed as an argument to TEST, and is deleted only if the return
value is non-nil."
  (cdr (avl-tree--do-delete (avl-tree--cmpfun tree)
			    (avl-tree--dummyroot tree)
			    0 data test nilflag)))