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.
This commit is contained in:
parent
a536e5beca
commit
81b2514edd
|
@ -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
|
||||
tmp-file))) ; HTML png PDF pdf
|
||||
|
|
Loading…
Reference in New Issue
Block a user