Added with-output-to-string.
This commit is contained in:
parent
894a29f0d8
commit
79277bb394
|
@ -44,7 +44,7 @@
|
||||||
put-string
|
put-string
|
||||||
open-bytevector-output-port
|
open-bytevector-output-port
|
||||||
call-with-bytevector-output-port
|
call-with-bytevector-output-port
|
||||||
open-string-output-port
|
open-string-output-port with-output-to-string
|
||||||
call-with-string-output-port
|
call-with-string-output-port
|
||||||
standard-output-port standard-error-port
|
standard-output-port standard-error-port
|
||||||
current-output-port current-error-port
|
current-output-port current-error-port
|
||||||
|
@ -92,7 +92,7 @@
|
||||||
put-string
|
put-string
|
||||||
open-bytevector-output-port
|
open-bytevector-output-port
|
||||||
call-with-bytevector-output-port
|
call-with-bytevector-output-port
|
||||||
open-string-output-port
|
open-string-output-port with-output-to-string
|
||||||
call-with-string-output-port
|
call-with-string-output-port
|
||||||
standard-output-port standard-error-port
|
standard-output-port standard-error-port
|
||||||
current-output-port current-error-port
|
current-output-port current-error-port
|
||||||
|
@ -427,6 +427,15 @@
|
||||||
(let-values ([(p extract) (open-string-output-port)])
|
(let-values ([(p extract) (open-string-output-port)])
|
||||||
(proc p)
|
(proc p)
|
||||||
(extract)))
|
(extract)))
|
||||||
|
|
||||||
|
(define (with-output-to-string proc)
|
||||||
|
(define who 'with-output-to-string)
|
||||||
|
(unless (procedure? proc)
|
||||||
|
(die who "not a procedure" proc))
|
||||||
|
(let-values ([(p extract) (open-string-output-port)])
|
||||||
|
(parameterize ([*the-output-port* p])
|
||||||
|
(proc))
|
||||||
|
(extract)))
|
||||||
|
|
||||||
(define (open-string-output-port)
|
(define (open-string-output-port)
|
||||||
(define who 'open-string-output-port)
|
(define who 'open-string-output-port)
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
1278
|
1279
|
||||||
|
|
Loading…
Reference in New Issue