Commit aa8fa5f8be169153613487aab40911ce8c15699f

Thomas de Grivel 2013-12-17T18:36:42

Fix WALK-STR performances as it would walk strings char by char.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
diff --git a/str.lisp b/str.lisp
index 7f67ed2..1aee813 100644
--- a/str.lisp
+++ b/str.lisp
@@ -104,9 +104,10 @@
 
 (defun walk-str (fn str)
   (labels ((walk (x)
-	     (if (typep x 'sequence)
-		 (map nil #'walk x)
-		 (funcall fn (atom-str x)))))
+	     (typecase x
+	       (string (funcall fn x))
+	       (sequence (map nil #'walk x))
+	       (t (funcall fn (atom-str x))))))
     (walk str)))
 
 (defun str (&rest parts)