Skip to main content

synonym-stream-symbol

synonym-stream-symbol Function

Syntax:

synonym-stream-symbol synonym-stream → symbol

Arguments and Values:

synonym-stream—a synonym stream.

symbol—a symbol.

Description:

Returns the symbol whose symbol-value the synonym-stream is using.

See Also:

make-synonym-stream

Expanded Reference: synonym-stream-symbol

Basic Usage

synonym-stream-symbol returns the symbol whose value the synonym stream uses as its target.

(let ((syn (make-synonym-stream '*standard-output*)))
(synonym-stream-symbol syn))
=> *STANDARD-OUTPUT*

With a Custom Variable

(defvar *my-custom-stream* (make-string-output-stream))

(let ((syn (make-synonym-stream '*my-custom-stream*)))
(synonym-stream-symbol syn))
=> *MY-CUSTOM-STREAM*

Practical Use

Knowing the symbol lets you understand which dynamic variable a synonym stream is tracking.

(let ((syn (make-synonym-stream '*standard-input*)))
(eq (synonym-stream-symbol syn) '*standard-input*))
=> T