Skip to content

Commit

Permalink
made string-builders behave like the other collectors (rather than
Browse files Browse the repository at this point in the history
clearing their output after retrieving it the first time)
  • Loading branch information
bobbysmith007 committed Dec 20, 2011
1 parent 09c0856 commit 61b2270
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion collectors.lisp
Expand Up @@ -53,7 +53,13 @@
(lambda (&rest args) (lambda (&rest args)
(if args (if args
(mapc #'p args) (mapc #'p args)
(get-output-stream-string s)))))) ;; todo: this seems pretty hacky, but I would like to maintain the interface
;; of all the other collectors (of being able to access intermediate output
;; repeatedly), so for now I guess this is it. Should test to see if
;; writing / coercing an array is faster or slower
(let ((so-far (get-output-stream-string s)))
(write-string so-far s)
so-far))))))


(defmacro with-string-builder ((name &key delimiter (ignore-empty-strings-and-nil t)) (defmacro with-string-builder ((name &key delimiter (ignore-empty-strings-and-nil t))
&body body) &body body)
Expand Down

0 comments on commit 61b2270

Please sign in to comment.