/, //, ///
/, //, /// Variable
Value Type:
a proper list.
Initial Value:
implementation-dependent.
Description:
The variables /, //, and /// are maintained by the Lisp read-eval-print loop to save the values of results that were printed at the end of the loop.
The value of / is a list of the most recent values that were printed, the value of // is the previous value of /, and the value of /// is the previous value of //.
The values of /, //, and /// are updated immediately prior to printing the return value of a top-level form by the Lisp read-eval-print loop. If the evaluation of such a form is aborted prior to its normal return, the values of /, //, and /// are not updated.
Examples:
(floor 22 7) → 3, 1
(+ (\* (car /) 7) (cadr /)) → 22
Affected By:
Lisp read-eval-print loop.
See Also:
- (variable), + (variable), * (variable), Section 25.1.1 (Top level loop)
lisp-implementation-type, lisp-implementation version FunctionSyntax:
lisp-implementation-type ⟨no arguments⟩ → description
lisp-implementation-version ⟨no arguments⟩ → description
Arguments and Values:
description—a string or nil.
Description:
lisp-implementation-type and lisp-implementation-version identify the current implementation of Common Lisp.
lisp-implementation-type returns a string that identifies the generic name of the particular Common Lisp implementation.
lisp-implementation-version returns a string that identifies the version of the particular Common Lisp implementation.
If no appropriate and relevant result can be produced, nil is returned instead of a string.
Examples:
(lisp-implementation-type)
→ "ACME Lisp"
<i><sup>or</sup>→</i> "Joe’s Common Lisp"
(lisp-implementation-version)
→ "1.3a"
→ "V2"
<i><sup>or</sup>→</i> "Release 17.3, ECO #6"
**short-site-name, long-site-name** *Function*
Syntax:
short-site-name ⟨no arguments⟩ → description
long-site-name ⟨no arguments⟩ → description
Arguments and Values:
description—a string or nil.
Description:
short-site-name and long-site-name return a string that identifies the physical location of the computer hardware, or nil if no appropriate description can be produced.
Examples:
(short-site-name)
→ "MIT AI Lab"
<i><sup>or</sup>→</i> "CMU-CSD"
(long-site-name)
→ "MIT Artificial Intelligence Laboratory"
<i><sup>or</sup>→</i> "CMU Computer Science Department"
Affected By:
The implementation, the location of the computer hardware, and the installation/configuration process.
Expanded Reference: /, //, ///
Basic Usage
The variables /, //, and /// hold the lists of values returned by the last three forms evaluated at the REPL. / contains a list of all values from the most recent evaluation, // the one before that, and /// the one before //.
(+ 10 20)
=> 30
;; In an interactive REPL after the above:
;; / => (30) ; list of values from last evaluation
;; (first /) => 30
Multiple Return Values
The primary usefulness of / is that it captures all values from a multiple-value-returning form, not just the primary value.
(floor 17 5)
=> 3
=> 2
;; In an interactive REPL after the above:
;; / => (3 2) ; both values captured
;; (first /) => 3
;; (second //) => 2
History Shifting
Like the + family, the / variables shift with each REPL evaluation: old / becomes //, old // becomes ///.
(values :a :b)
=> :A
=> :B
(values :c :d :e)
=> :C
=> :D
=> :E
;; In an interactive REPL after the above:
;; / => (:C :D :E) ; values from most recent evaluation
;; // => the values from the evaluation of /
;; /// => (:A :B) ; values from two evaluations ago
Retrieving Results for Further Computation
A common use is to capture a result you forgot to bind to a variable.
(* 123456 789012)
=> 97408265472
(defvar *saved-result* (first /))
=> *SAVED-RESULT*
*saved-result*
=> 97408265472
Distinction from +, ++, +++
The / family tracks result values (as lists), while the + family tracks the forms that were read. Together they provide a complete history of recent REPL interaction.
(list 1 2 3)
=> (1 2 3)
;; In an interactive REPL after the above:
;; + => (LIST 1 2 3) ; the form that was read
;; / => ((1 2 3)) ; the list of result values