Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Simplify searching.

  • Loading branch information...
commit facb3a85e02cc765bcc1c608e712c17d0e6b3305 1 parent 877d164
Stas Boukarev authored
Showing with 11 additions and 10 deletions.
  1. +3 −1 kmp.lisp
  2. +8 −9 storage.lisp
4 kmp.lisp
View
@@ -27,7 +27,9 @@
(declaim (inline reverse-case))
(defun reverse-case (string)
(declare (simple-string string)
- (optimize speed))
+ (optimize speed)
+ #+sbcl
+ (sb-ext:muffle-conditions sb-ext:compiler-note))
(let ((reversed (make-string (length string))))
(loop for char across string
for i from 0
17 storage.lisp
View
@@ -78,10 +78,11 @@
(setf (id object) -1))
t)
-(defun map-data (function)
+(defun map-data (function &key (type t))
(dolist (class (storage-data *storage*))
- (funcall function
- class (objects-of-class class))))
+ (when (subtypep class type)
+ (funcall function
+ class (objects-of-class class)))))
(defun map-type (type function)
(let ((type (if (eql type t)
@@ -151,12 +152,10 @@
(function
`(funcall ,value ,slot))
(string
- (if (= (length value) 1)
- `(find ,(char value 0) ,slot :test #'char-equal)
- (let ((reversed (reverse-case value)))
- `(and ,slot
- (do-kmp ,value ,reversed
- ,slot ,(build-table value reversed))))))
+ (let ((reversed (reverse-case value)))
+ `(and (string-p ,slot)
+ (do-kmp ,value ,reversed
+ ,slot ,(build-table value reversed)))))
(t
`(equalp ,value ,slot))))
slots values)))))))
Please sign in to comment.
Something went wrong with that request. Please try again.