Browse code
Fix count-sequence
Showing 1 changed files
... | ... |
@@ -32,11 +32,13 @@ |
32 | 32 |
|
33 | 33 |
(defmethod count-sequence ((sequence string) &key (test 'eql) (key 'identity)) |
34 | 34 |
(let ((result (make-instance 'counter :test test :key key))) |
35 |
- (loop for c across sequence |
|
36 |
- do (incf (gethash (funcall key c) |
|
35 |
+ (prog1 result |
|
36 |
+ (map 'list |
|
37 |
+ (lambda (c) |
|
38 |
+ (incf (gethash (funcall key c) |
|
37 | 39 |
(item-counts result) |
38 |
- 0)) |
|
39 |
- finally (return result)))) |
|
40 |
+ 0))) |
|
41 |
+ sequence)))) |
|
40 | 42 |
|
41 | 43 |
(defmethod format-counts ((counter counter) (stream stream)) |
42 | 44 |
(let ((result '())) |