string-map - map a procedure over the characters in strings
LIBRARY
(import (scheme base)) ;R7RS
SYNOPSIS
(string-map proc string1 string2 ...)
DESCRIPTION
The
string-map
procedure applies
proc
element-wise to the elements of the strings and returns a string of
the results, in order.
If more than one string is given and not all strings have the same
length,
string-map
terminates when the shortest string runs out.
The dynamic order in which
proc
is applied to the elements of the strings is unspecified.
If multiple returns occur from
string-map,
the values returned by earlier returns are not mutated.
RETURN VALUES
Returns a single string object.
EXAMPLES
(string-map char-foldcase "AbdEgH")
=> "abdegh"
(string-map
(lambda (c)
(integer->char (+ 1 (char->integer c))))
"HAL")
=> "IBM"
; Demonstrates how it ends on the shortest string
(string-map
(lambda (c k)
((if (eqv? k #) char-upcase char-downcase)
c))
"studlycaps xxx"
"ululululul")
=> "StUdLyCaPs"
ERRORS
It is an error if
proc
does not accept as many arguments as there
are strings or does not return a single character.
It is likewise an error if there are fewer than
two arguments or if one of the arguments is outside its domain.
Implementations may signal an error, extend the procedure's
domain of definition to include such arguments,
or fail catastrophically.
SEE ALSO
map(3scm)
STANDARDS
R7RS
HISTORY
This procedure also appears in SRFI-13.
AUTHORS
This page is part of the
scheme-manpages
project.
It includes materials from the RnRS documents.
More information can be found at
https://github.com/schemedoc/manpages/
.
Markup created by unroff 1.0sc, March 04, 2023.