diff options
| author | Thien-Thi Nguyen | 2007-08-27 01:35:41 +0000 |
|---|---|---|
| committer | Thien-Thi Nguyen | 2007-08-27 01:35:41 +0000 |
| commit | 25e32569d41466ef97acf433a062c5d02a3601cf (patch) | |
| tree | c0a074df0047a7083abc19bdc42be59a7e4b00a5 | |
| parent | fb5da2db3e0b8d52337682ce59f397a5ae88869f (diff) | |
| download | emacs-25e32569d41466ef97acf433a062c5d02a3601cf.tar.gz emacs-25e32569d41466ef97acf433a062c5d02a3601cf.zip | |
Don't require `cl'.
(elib-stack-create, elib-stack-push, elib-stack-pop): Delete funcs.
(elib-avl-mapc): Use `nil' for new stack, and `push' and `pop' directly.
| -rw-r--r-- | lisp/emacs-lisp/avl-tree.el | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/lisp/emacs-lisp/avl-tree.el b/lisp/emacs-lisp/avl-tree.el index 604147f618e..b68ebc47de3 100644 --- a/lisp/emacs-lisp/avl-tree.el +++ b/lisp/emacs-lisp/avl-tree.el | |||
| @@ -97,11 +97,6 @@ | |||
| 97 | ;; NEWVAL is new value of the branch." | 97 | ;; NEWVAL is new value of the branch." |
| 98 | (` (aset (, node) (, branch) (, newval)))) | 98 | (` (aset (, node) (, branch) (, newval)))) |
| 99 | 99 | ||
| 100 | (eval-when-compile (require 'cl)) | ||
| 101 | (defun elib-stack-create () (list)) | ||
| 102 | (defmacro elib-stack-push (stack object) `(push ,object ,stack)) | ||
| 103 | (defmacro elib-stack-pop (stack) `(pop ,stack)) | ||
| 104 | |||
| 105 | ;;; ================================================================ | 100 | ;;; ================================================================ |
| 106 | ;;; Functions and macros handling an AVL tree node. | 101 | ;;; Functions and macros handling an AVL tree node. |
| 107 | 102 | ||
| @@ -413,15 +408,15 @@ | |||
| 413 | ;; Note: MAP-FUNCTION is applied to the node and not to the data itself. | 408 | ;; Note: MAP-FUNCTION is applied to the node and not to the data itself. |
| 414 | ;; INTERNAL USE ONLY. | 409 | ;; INTERNAL USE ONLY. |
| 415 | (let ((node root) | 410 | (let ((node root) |
| 416 | (stack (elib-stack-create)) | 411 | (stack nil) |
| 417 | (go-left t)) | 412 | (go-left t)) |
| 418 | (elib-stack-push stack nil) | 413 | (push nil stack) |
| 419 | (while node | 414 | (while node |
| 420 | (if (and go-left | 415 | (if (and go-left |
| 421 | (elib-node-left node)) | 416 | (elib-node-left node)) |
| 422 | ;; Do the left subtree first. | 417 | ;; Do the left subtree first. |
| 423 | (progn | 418 | (progn |
| 424 | (elib-stack-push stack node) | 419 | (push node stack) |
| 425 | (setq node (elib-node-left node))) | 420 | (setq node (elib-node-left node))) |
| 426 | ;; Apply the function... | 421 | ;; Apply the function... |
| 427 | (funcall map-function node) | 422 | (funcall map-function node) |
| @@ -429,7 +424,7 @@ | |||
| 429 | (if (elib-node-right node) | 424 | (if (elib-node-right node) |
| 430 | (setq node (elib-node-right node) | 425 | (setq node (elib-node-right node) |
| 431 | go-left t) | 426 | go-left t) |
| 432 | (setq node (elib-stack-pop stack) | 427 | (setq node (pop stack) |
| 433 | go-left nil)))))) | 428 | go-left nil)))))) |
| 434 | 429 | ||
| 435 | (defun elib-avl-do-copy (root) | 430 | (defun elib-avl-do-copy (root) |