Add prospect-pretty-print->string
This commit is contained in:
parent
07f7fcb060
commit
e4eed9a9e4
|
@ -3,6 +3,8 @@
|
|||
(provide gen:prospect-pretty-printable
|
||||
prospect-pretty-print
|
||||
|
||||
prospect-pretty-print->string
|
||||
|
||||
exn->string ;; required from exn-util.rkt
|
||||
string-indent
|
||||
indented-port-output)
|
||||
|
@ -22,6 +24,11 @@
|
|||
(define (prospect-pretty-print v [p (current-output-port)])
|
||||
(pretty-write v p))]))
|
||||
|
||||
(define (prospect-pretty-print->string v)
|
||||
(define p (open-output-string))
|
||||
(prospect-pretty-print v p)
|
||||
(get-output-string p))
|
||||
|
||||
(define (string-indent amount s)
|
||||
(define pad (make-string amount #\space))
|
||||
(string-join (for/list [(line (string-split s "\n"))] (string-append pad line)) "\n"))
|
||||
|
|
Loading…
Reference in New Issue