machine-instance
machine-instance Function
Syntax:
machine-instance ⟨no arguments⟩ → description
Arguments and Values:
description—a string or nil.
Description:
Returns a string that identifies the particular instance of the computer hardware on which Common Lisp is running, or nil if no such string can be computed.
Examples:
(machine-instance)
→ "ACME.COM"
<i><sup>or</sup>→</i> "S/N 123231"
<i><sup>or</sup>→</i> "18.26.0.179"
<i><sup>or</sup>→</i> "AA-00-04-00-A7-A4"
Affected By:
The machine instance, and the implementation.
See Also:
machine-type, machine-version
Expanded Reference: machine-instance
Basic Usage
machine-instance returns a string that identifies the particular machine (host) on which the Lisp implementation is running. The exact content is implementation-dependent.
(or (stringp (machine-instance)) (null (machine-instance)))
;; => T
Typical Return Values
Different implementations may return hostnames, fully qualified domain names, or other identifiers. The function may also return NIL if no meaningful value can be determined.
;; On SBCL running on a Linux host, returns the hostname string
;; On some implementations where host info is unavailable, returns NIL
(stringp (machine-instance))
;; => impl-dependent
Using in Diagnostic Output
machine-instance is commonly used alongside other environment-querying functions to produce diagnostic or logging information.
(stringp (format nil "Running on ~A (~A ~A)"
(or (machine-instance) "unknown host")
(or (machine-type) "unknown type")
(or (machine-version) "unknown version")))
;; => T
Important Notes
The return value is a string or NIL. The format and content are entirely implementation-dependent -- there is no portable way to rely on the structure of the returned string.