textual-port?(3scm) Scheme Programmer's Manual textual-port?(3scm)

textual-port?, binary-port? - test if ports are textual or binary

(import (rnrs))                     ;R6RS
(import (rnrs io ports))            ;R6RS
(import (scheme base))              ;R7RS

(binary-port? port)
(textual-port? port)

The textual-port? procedure returns #t if port is textual, and returns #f otherwise. The binary-port? procedure returns #t if port is binary, and returns #f otherwise.
R7RS
These procedures accept any kind of object.

Returns a single boolean object.

(call-with-input-file "/dev/null" textual-port?)
   => #t
(binary-port? (open-bytevector-input-port #vu8(1 2 3)))
   => #t

Some R7RS implementations may allow both binary and textual operations on ports.

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
Passing the wrong number of arguments is an error. Implementations may signal an error, extend the procedure's domain of definition to include such arguments, or fail catastrophically.

input-port?(3scm).

R6RS, R7RS

New in R6RS and new in R7RS. In R5RS and earlier reports, ports were conceptually textual.

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

2021-06-25