From 3f9e5b57cbec5cd506a691578746b17edc3597ee Mon Sep 17 00:00:00 2001 From: Russ Tyndall Date: Fri, 15 Jul 2011 10:30:59 -0400 Subject: [PATCH] added a with-string-builder-output macro that outputs the string as the result of the form --- collectors.lisp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/collectors.lisp b/collectors.lisp index 7ed9a6b..3cf4929 100644 --- a/collectors.lisp +++ b/collectors.lisp @@ -12,6 +12,7 @@ #:with-appender #:make-appender #:with-string-builder + #:with-string-builder-output #:make-string-builder #:with-mapping-collector #:with-mapping-appender @@ -63,6 +64,15 @@ (flet ((,name (&rest items) (apply ,it items))) ,@body)))) +(defmacro with-string-builder-output ((name &key delimiter (ignore-empty-strings-and-nil t)) + &body body) + "A macro that creates a string builder with name in scope during the + duration of the env, the form returns the string that is built" + `(with-string-builder (,name :delimiter ,delimiter + :ignore-empty-strings-and-nil ,ignore-empty-strings-and-nil) + ,@body + (,name))) + ;;;; * Reducing and Collecting ;;;; ** Reducing