mes: Add string-map.
* module/srfi/srfi-13.mes (string-map): New function. * tests/srfi-13.test ("string-map"): Test it.
This commit is contained in:
parent
59d4d90a90
commit
563d1d92f9
|
@ -154,3 +154,6 @@
|
||||||
(define (string-trim-both string . pred)
|
(define (string-trim-both string . pred)
|
||||||
((compose string-trim string-trim-right) string))
|
((compose string-trim string-trim-right) string))
|
||||||
|
|
||||||
|
(define (string-map f string)
|
||||||
|
(list->string (map f (string->list string))))
|
||||||
|
|
||||||
|
|
|
@ -77,4 +77,7 @@ exit $?
|
||||||
(pass-if-equal "string-trim-both" "foo"
|
(pass-if-equal "string-trim-both" "foo"
|
||||||
(string-trim-both " foo "))
|
(string-trim-both " foo "))
|
||||||
|
|
||||||
|
(pass-if-equal "string-map" "fuubar"
|
||||||
|
(string-map (lambda (c) (if (eq? c #\o) #\u c)) "foobar"))
|
||||||
|
|
||||||
(result 'report)
|
(result 'report)
|
||||||
|
|
Loading…
Reference in a new issue