Skip to main content

streamp

streamp Function

Syntax:

streamp object → generalized-boolean

Arguments and Values:

object—an object.

generalized-boolean—a generalized boolean.

Description:

Returns true if object is of type stream; otherwise, returns false.

streamp is unaffected by whether object, if it is a stream, is open or closed.

Examples:

(streamp \*terminal-io\*) → true 
(streamp 1) → false

Notes:

(streamp object) (typep object ’stream)

Expanded Reference: streamp

Basic Usage

streamp returns true if its argument is a stream; otherwise returns false.

(streamp *standard-input*)
=> T

Non-Stream Objects

Non-stream objects return false.

(streamp 42)
=> NIL

(streamp "hello")
=> NIL

(streamp nil)
=> NIL

Various Stream Types

All kinds of streams satisfy streamp.

(streamp (make-string-input-stream "test"))
=> T

(streamp (make-string-output-stream))
=> T

(streamp (make-broadcast-stream))
=> T

Closed Streams

streamp returns true even for closed streams.

(let ((s (make-string-output-stream)))
(close s)
(streamp s))
=> T