aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-06-23 04:21:16 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2022-06-23 04:21:16 +0200
commit8517a196f4110376ce769611594cd8692f72dc7c (patch)
treed6bf928850ffee9372d86a4587cc0bf6036b8521
parentLimit imports in (srfi srfi-41 util). (diff)
downloadcalp-8517a196f4110376ce769611594cd8692f72dc7c.tar.gz
calp-8517a196f4110376ce769611594cd8692f72dc7c.tar.xz
Remove ->str and ->quoted-string.
->str as an alias of ->string is removed. ->string is however left. ->quoted-string was always weird, and was only used once.
-rw-r--r--doc/ref/guile/util.texi8
-rw-r--r--module/hnh/util.scm9
-rw-r--r--module/sxml/transformations.scm2
-rw-r--r--module/web/uri-query.scm3
-rw-r--r--tests/test/util.scm4
5 files changed, 5 insertions, 21 deletions
diff --git a/doc/ref/guile/util.texi b/doc/ref/guile/util.texi
index d7ed0785..f7a0f77e 100644
--- a/doc/ref/guile/util.texi
+++ b/doc/ref/guile/util.texi
@@ -310,16 +310,10 @@ non-unique keys, returning all mathing records (instead of just the first).
Returns the last element of @var{v}.
@end defun
-@defun ->str any
-@defunx ->string any
+@defun ->string any
Converts @var{any} to a string, as per @var{display}.
@end defun
-@defun ->quoted-string any
-Converts @var{any} to a string, as per @var{write}.
-@end defun
-
-
@defmac let-env bindings body ...
Similar to @var{let}, but sets environment variables for the code in
diff --git a/module/hnh/util.scm b/module/hnh/util.scm
index b0e6b81a..46557e38 100644
--- a/module/hnh/util.scm
+++ b/module/hnh/util.scm
@@ -58,7 +58,7 @@
vector-last
- ->str ->string ->quoted-string
+ ->string
catch*
)
@@ -530,14 +530,9 @@
(define (vector-last v)
(vector-ref v (1- (vector-length v))))
-(define (->str any)
+(define (->string any)
(with-output-to-string (lambda () (display any))))
-(define ->string ->str)
-
-(define (->quoted-string any)
- (with-output-to-string (lambda () (write any))))
-
(define-syntax catch*
diff --git a/module/sxml/transformations.scm b/module/sxml/transformations.scm
index 61de42aa..09b26ad4 100644
--- a/module/sxml/transformations.scm
+++ b/module/sxml/transformations.scm
@@ -31,7 +31,7 @@
(attribute-transformer
tree
`((href . ,(lambda (_ . content)
- `(href ,@(transformer (string-concatenate (map ->str content))))
+ `(href ,@(transformer (string-concatenate (map ->string content))))
)))))
(define (href-prefixer tree prefix)
diff --git a/module/web/uri-query.scm b/module/web/uri-query.scm
index adf99803..e7cc627c 100644
--- a/module/web/uri-query.scm
+++ b/module/web/uri-query.scm
@@ -1,5 +1,4 @@
(define-module (web uri-query)
- :use-module ((hnh util) :select (->quoted-string))
:use-module ((web uri) :select (uri-encode))
:export (encode-query-parameters)
)
@@ -14,7 +13,7 @@
(map (lambda (p)
(format #f "~a=~a"
(car p)
- (uri-encode (->quoted-string (cdr p)))))
+ (uri-encode (with-output-to-string (lambda () (write (cdr p)))))))
parameters)
"&"))
diff --git a/tests/test/util.scm b/tests/test/util.scm
index e6b0c214..1de96a37 100644
--- a/tests/test/util.scm
+++ b/tests/test/util.scm
@@ -226,10 +226,6 @@
(test-equal "5" (->string "5"))
-(test-equal "5" (->quoted-string 5))
-
-(test-equal "\"5\"" (->quoted-string "5"))
-
(test-equal
"no slashes"
"home/user"