From b09691b70aee57cc5b507dec088eeaedcb083fdd Mon Sep 17 00:00:00 2001 From: Nathan Froyd Subject: [PATCH 22/39] clean up PROGN ugliness in TRIE-INCLUDE-PRUNE-P --- src/lisp/structs.lisp | 52 +++++++++++++++++++++--------------------------- 1 files changed, 23 insertions(+), 29 deletions(-) diff --git a/src/lisp/structs.lisp b/src/lisp/structs.lisp index a39dfd1..8c6e7d6 100755 --- a/src/lisp/structs.lisp +++ b/src/lisp/structs.lisp @@ -171,35 +171,29 @@ (let* ((byte (aref str (trie-level tr))) (letter (char-code byte))) (if (eql letter 0) - (progn - (if (eql (trie-text tr) nil) - nil - (if (not (trie-is-word tr)) - nil - (progn - (let ((parent (trie-parent tr))) - (setf (trie-is-word tr) nil) - (dec-word-count tr) -;; (if (= (trie-word-count parent) 0) -;; (setf (trie-children parent) -;; +empty-children+))) - t))))) - (progn - (let* ((ind (- letter (char-code #\A))) - (children (trie-children tr)) - (ttr (aref children ind))) - (declare - (type (unsigned-byte 8) ind) - #+sbcl (type trie-children-vector children) - #+sbcl (type (or (unsigned-byte 8) trie) ttr) - ;; ccl is smart enough to not barf on a 0 pointer - #+ccl (type trie-children-vector children) - #+ccl (type trie ttr) - #+cmu (type trie-children-vector children) - #+cmu (type trie ttr) - ) - (and (not (eql ttr 0)) - (trie-include-prune-p ttr str))))))) + (if (eql (trie-text tr) nil) + nil + (if (not (trie-is-word tr)) + nil + (let ((parent (trie-parent tr))) + (setf (trie-is-word tr) nil) + (dec-word-count tr) + t))) + (let* ((ind (- letter (char-code #\A))) + (children (trie-children tr)) + (ttr (aref children ind))) + (declare + (type (unsigned-byte 8) ind) + #+sbcl (type trie-children-vector children) + #+sbcl (type (or (unsigned-byte 8) trie) ttr) + ;; ccl is smart enough to not barf on a 0 pointer + #+ccl (type trie-children-vector children) + #+ccl (type trie ttr) + #+cmu (type trie-children-vector children) + #+cmu (type trie ttr) + ) + (and (not (eql ttr 0)) + (trie-include-prune-p ttr str)))))) (defun trie-begin-p (tr str) "Tests whether any words exist in the trie that begin with str" -- 1.6.2