From 81b2514edd6d8b56b6c218676daea611e8cb484a Mon Sep 17 00:00:00 2001 From: "D. Ben Knoble" Date: Sat, 23 Nov 2024 08:57:03 -0500 Subject: [PATCH] asymptote: simplify string construction Preserve the exact content of the string while using a simpler construction. I think ~a (display-style) might be redundant on strings, but without contracts the input might be non-strings, so keep it. Even simpler would be (apply ~a #:separator "\n" s strs), but that changes the hash because it misses the final newline. An uncommitted version used (string-join (map ~a (cons s strs)) "\n" #:after-last "\n") for a similar effect. --- asymptote.rkt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/asymptote.rkt b/asymptote.rkt index be9409a5a..226c19a0d 100644 --- a/asymptote.rkt +++ b/asymptote.rkt @@ -8,9 +8,7 @@ (define (asymptote #:cache [cache? #t] s . strs) (define single-str - (with-output-to-string - (lambda () (for ([str (in-list `(,s . ,strs))]) - (displayln str))))) + (string-append (apply ~a #:separator "\n" s strs) "\n")) (if cache? ;; cache: (let* ([asymptote-dir "asymptote-images"] @@ -54,4 +52,4 @@ (λ () ;(with-output-to-string (system (format "asy -v -f png -o ~a" tmp-file)))) - tmp-file))) ; HTML png PDF pdf \ No newline at end of file + tmp-file))) ; HTML png PDF pdf