Function: avl-tree-iter

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

Signature

(avl-tree-iter TREE &optional REVERSE)

Documentation

Return an AVL tree iterator object.

Calling iter-next on this object will retrieve the next element from TREE. If REVERSE is non-nil, elements are returned in reverse order.

Note that any modification to TREE *immediately* invalidates all iterators created from TREE before the modification (in particular, calling iter-next will give unpredictable results).

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/avl-tree.el.gz
(iter-defun avl-tree-iter (tree &optional reverse)
  "Return an AVL tree iterator object.

Calling `iter-next' on this object will retrieve the next element
from TREE.  If REVERSE is non-nil, elements are returned in
reverse order.

Note that any modification to TREE *immediately* invalidates all
iterators created from TREE before the modification (in
particular, calling `iter-next' will give unpredictable results)."
  (let ((stack (avl-tree-stack tree reverse)))
    (while (not (avl-tree-stack-empty-p stack))
      (iter-yield (avl-tree-stack-pop stack)))))