How to get a reference to the last returned object in Emacs Slime
Asked Answered
C

2

5

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?

Clutter answered 4/1, 2016 at 16:2 Comment(0)
T
9

Common Lisp defines some variables which are bound the previous form and their values. These are:

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.

Tunic answered 4/1, 2016 at 16:41 Comment(0)
S
6

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.

Selfgratification answered 4/1, 2016 at 18:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.