diff options
author | Case Duckworth | 2023-08-28 23:20:53 -0500 |
---|---|---|
committer | Case Duckworth | 2023-08-28 23:20:53 -0500 |
commit | 8701fe064a6b56e203f6a452d65d18216f18777e (patch) | |
tree | f50ab4d60acbd09986114b473c16445c2e30e43f /schmaltz.sls | |
parent | Add unprintable helper functions (diff) | |
download | schmaltz-8701fe064a6b56e203f6a452d65d18216f18777e.tar.gz schmaltz-8701fe064a6b56e203f6a452d65d18216f18777e.zip |
Change render semantics
Now `render` outputs to the current output port, not a string. `render->string` and `render-string->string` added to output to a string.
Diffstat (limited to 'schmaltz.sls')
-rw-r--r-- | schmaltz.sls | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/schmaltz.sls b/schmaltz.sls index 4afcf40..c47467a 100644 --- a/schmaltz.sls +++ b/schmaltz.sls | |||
@@ -46,6 +46,18 @@ | |||
46 | (lambda (port) | 46 | (lambda (port) |
47 | (render env port)))))) | 47 | (render env port)))))) |
48 | 48 | ||
49 | (define (render->string . args) | ||
50 | (call-with-port (open-output-string) | ||
51 | (lambda (out) | ||
52 | (apply render args) | ||
53 | (get-output-string out)))) | ||
54 | |||
55 | (define (render-string->string str . args) | ||
56 | (call-with-port (open-output-string) | ||
57 | (lambda (out) | ||
58 | (apply render-string args) | ||
59 | (get-output-string out)))) | ||
60 | |||
49 | ;;; Configuration | 61 | ;;; Configuration |
50 | 62 | ||
51 | (define render-environment | 63 | (define render-environment |
@@ -83,3 +95,4 @@ | |||
83 | 95 | ||
84 | (define (unprintable/backtrack ch) | 96 | (define (unprintable/backtrack ch) |
85 | (list ch #\#)) | 97 | (list ch #\#)) |
98 | (display (list->string (reverse acc)))) | ||