put-string, write-string - write a string to a textual output port
LIBRARY
(import (rnrs)) ;R6RS
(import (rnrs io ports)) ;R6RS
(import (scheme base)) ;R7RS
SYNOPSIS
; R6RS only:
(put-string textual-output-port string)
(put-string textual-output-port string start)
(put-string textual-output-port string start count)
; R7RS only:
(write-string string)
(write-string string textual-output-port)
(write-string string textual-output-port start)
(write-string string textual-output-port start end)
DESCRIPTION
Writes the
characters of
string
starting at index
start
to
textual-output-port.
- R6RS
-
Exactly
count
characters are written,
defaulting to
(string-length string) − start.
- R7RS
-
The characters from
start
to
end
are written,
with
end
defaulting to
(string-length string).
The
start
argument defaults to 0.
RETURN VALUES
- R6RS
-
Returns unspecified values.
- R7RS
-
Returns an unspecified value.
EXAMPLES
(write-string "Hello, world!\n")
APPLICATION USAGE
This procedure is used, instead of a generic procedure like
display(scheme),
because it is slightly faster and makes it possible to write only part
of the string.
RATIONALE
The R7RS variant specifies
end
instead of
count
to be consistent with other procedures.
ERRORS
This procedure can raise exceptions with the following condition types:
- &assertion (R6RS)
-
The wrong number of arguments was passed or an argument was outside its domain.
In particular,
start
and
count
must be non-negative exact integer objects,
and
string
must have a length of at least
start
+
count.
- R7RS
-
The assertions described above are errors.
Implementations may signal an error, extend the procedure's
domain of definition to include such arguments,
or fail catastrophically.
SEE ALSO
put-char(3scm),
display(3scm),
open-file-output-port(3scm)
STANDARDS
R6RS,
R7RS
HISTORY
The
put-string
procedure was introduced in R6RS as part of the reworked I/O design.
The
write-string
procedure is new in R7RS.
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.