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:
Jan Nieuwenhuizen 2018-04-29 18:26:46 +02:00
parent 59d4d90a90
commit 563d1d92f9
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273
2 changed files with 6 additions and 0 deletions

View file

@ -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))))

View file

@ -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)