Skip to main content

machine-version

machine-version Function

Syntax:

machine-version ⟨no arguments⟩ → description

Arguments and Values:

description—a string or nil.

Description:

Returns a string that identifies the version of the computer hardware on which Common Lisp is running, or nil if no such value can be computed.

Examples:

(machine-version)"KL-10, microcode 9" 

Affected By:

The machine version, and the implementation.

See Also:

machine-type, machine-instance

Expanded Reference: machine-version

Basic Usage

machine-version returns a string identifying the version of the hardware on which the Lisp implementation is running. The exact value is implementation-dependent.

(or (stringp (machine-version)) (null (machine-version)))
;; => T

Typical Return Values

Some implementations return detailed CPU model strings, while others return simpler identifiers or NIL.

;; On SBCL (Linux), returns a CPU model string
;; On some implementations where version info is unavailable, returns NIL
(stringp (machine-version))
;; => impl-dependent

Gathering Full Machine Identity

machine-version is most useful in combination with machine-type and machine-instance to build a complete picture of the execution environment.

(defun machine-info ()
(list :instance (machine-instance)
:type (machine-type)
:version (machine-version)))

(listp (machine-info))
;; => T

Important Notes

The return value is a string or NIL. The content and format of the string are entirely implementation-dependent. Some implementations may return the same value as machine-type or provide no additional detail beyond it.