From dd3b402163ec43d65a442cefa031fa0ce2aa511b Mon Sep 17 00:00:00 2001 From: Nathan Froyd Subject: [PATCH 29/39] inline WORD-FUNC and use WRITE-STRING instead of FORMAT --- src/lisp/solver.lisp | 17 +++++------------ 1 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/lisp/solver.lisp b/src/lisp/solver.lisp index 9abe0a1..bf2ab03 100755 --- a/src/lisp/solver.lisp +++ b/src/lisp/solver.lisp @@ -58,7 +58,7 @@ (format t "loaded ~D words.~%" (trie-word-count *dict-trie*))) -(defun find-words (ltr word fi tr word-func) +(defun find-words (ltr word fi tr) "Recursively find words by searching dictionary" (declare @@ -89,8 +89,8 @@ ;; Any words in the trie ? (when (and (>= (length word) *min-word-length*) (trie-include-prune-p tr word)) - ;; yield to the passed in func - (funcall word-func word)) + (setf (aref word fi) #\Newline) + (write-string word nil :end (1+ fi))) (let ((child (aref (trie-children tr) (- (char-code cc) (char-code #\A))))) @@ -102,7 +102,7 @@ (let ((neighbor (aref neighbors i))) #+ccl (declare (type letter neighbor)) (if (not (letter-used neighbor)) - (find-words neighbor word fi child word-func))))))) + (find-words neighbor word fi child))))))) ;; the letter is no longer in use (setf (letter-used ltr) nil))) @@ -133,11 +133,4 @@ letter word 0 - *dict-trie* - #'(lambda (word) - (progn - "add the word to the results" - ;;(vector-push-extend word results) - (format t "~A~%" word) - ;;(finish-output) ;; causes long delays in ccl ?! - ))))))))))) + *dict-trie*))))))))) -- 1.6.2