newline(3scm) Scheme Programmer's Manual newline(3scm)

newline - write a newline to a port

(import (rnrs))                     ;R6RS
(import (rnrs io simple))           ;R6RS
(import (scheme r5rs))              ;R7RS
(import (scheme base))              ;R7RS

(newline)
(newline textual-output-port)

Writes an end of line to textual-output-port, which defaults to the value returned by current-output-port(3scm).
R6RS
This is equivalent to using write-char(3scm) to write #\linefeed to textual-output-port.
The port transcoder's eol-style determines which characters will be written to the port.
Ports with their buffer-mode set to line will be flushed as a side-effect of calling this procedure.
R7RS
Exactly how a newline is produced, and which characters are used, differs from one operating system to another.

R6RS
Returns unspecified values.
R7RS
Returns an unspecified value.

(display "Hello, world!")
(newline)

In R6RS programs this procedure may be used instead of \n in a string or instead of writing #\linefeed. In R7RS programs this procedure writes the characters that would have been selected for a newline by using a transcoder with native-eol-style(3scm) in R6RS.

This procedure has had the same basic functionality since R2RS. In R6RS implementations it is possible to control the eol-style.

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.
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.

get-line(3scm), put-char(3scm)

R4RS, IEEE Scheme, R5RS, R6RS, R7RS

First appeared in R2RS. Scheme running on top of MacLisp has access to the same functionality through the terpri (TERminate PRInt line) function, which was also in LISP 1.5.

This page is part of the scheme-manpages project. It includes materials from the RnRS documents. More information can be found at https://weinholt.se/scheme/manpages/.

2022-05-07