On this page:
print
?
input
using
file
eof
eof?

3.5 Input and Output🔗ℹ

syntax

(print v)

(print & v)
(print lit v)
(print)
Prints the given v to the current output, or stdout if not otherwise specified, followed by a newline. (print & v) outputs without a newline, while (print lit v) outputs as a literal form that can be directly read back by (input stx ....) as code. A bare (print) merely prints a newline to the current output.

syntax

(? ....)

A shortened macro for print.

syntax

(input)

(input stx)
(input string)
(input stx string)
Reads a line of input from the current input, or stdin if not otherwise specified, and returns the value read as a string. (input stx ....) instead reads a value using the standard reader, thus providing syntax which can be evaluated with run. If additionally provided with a string, this will be output as a prompt to the current output.

syntax

(using io-port body ...)

Evaluates the body, with input/ouptut redirected to the given io-port. Only the file port is supported at this time.

syntax

(file name as mode)

Opens the file name as the new target for input or output, depending on the mode provided. mode is a symbol, of one of the following:

'output

 

Opens file as the current output port. Will fail if file already exists.

'rewrite

 

Opens file as the current output port, rewriting its contents if the file exists.

'input

 

Opens file as the current input port.

value

eof : eof-object?

A value (distinct from all other values) that represents an end-of-file.

procedure

(eof? v)  boolean?

  v : any?
Returns True if v is an eof object.