Using Emacs Slime, how can I access the object or value that was returned by the last expression in the REPL?
In ipython it's _
so that I can save it in a variable if the return value is what I expected.
Is there something similar for Slime?
Using Emacs Slime, how can I access the object or value that was returned by the last expression in the REPL?
In ipython it's _
so that I can save it in a variable if the return value is what I expected.
Is there something similar for Slime?
Common Lisp defines some variables which are bound the previous form and their values. These are:
*
, **
, ***
The most recent primary values./
, //
, ///
The most recent values (each of these is a list).+
, ++
, +++
The most recent forms.These variables are bound each time a form is evaluated in the REPL (which is what Slime is doing). *
, /
, and +
are bound the previous primary value, values and form. **
, //
, and ++
are bound to the previous values of *
, /
, //
. ***
, ///
, and +++
are bound the previous values of **
, //
, ++
.
Functions in Lisp may return more than one value; thus the difference between *
which holds the primary (first) value and /
which holds a list of all values.
In addition to verdammelts answer, you can also copy and paste objects from the repl. For an example see the third image in this article (that I wrote). For more information you should look at the presentations section of the Slime manual.
© 2022 - 2024 — McMap. All rights reserved.