What are the magic variables in CLISP REPL?

I noticed that when I type a statement in REPL, it often expands to a value that has something to do with the I / O history.

In particular, I noticed that:

  • + , ++ ... deploy to previous inputs,
  • * , ** ... expand to previous exits,
  • - expand to the current input

It seems like more ( / expands to something, but I didn't understand it for sure).

I tried to view detailed documents, but to no avail.

My questions:

  • What kind of REPL magic variables also exist? What are they doing?
  • Is there a way to access the nth input or output (e.g. IPython In and Out arrays)?
+4
source share
2 answers

REPL variables are documented in the Hyperspec dictionary (search for "Variable"). The standard does not require more input / output than three, and I am not aware of any implementation that does this.

+7
source

As mentioned in another answer, these variables are documented in the ANSI Common Lisp standard.

In addition to the fact that the implementation of Common Lisp can have many other functions. A fully featured top level with a user interface is often called a Lisp listener.

The CLISP implementation provides additional commands in the debugger. See chapter 25 of your documentation.

LispWorks has some extensions in REPL and also provides a listener . Here are some examples:

Interaction number 2 in the CL-USER package:

 CL-USER 2 > (* 3 4) 12 

Same thing, but we can omit the outer parentheses:

 CL-USER 3 > * 3 4 12 

Let re-interaction 2:

 CL-USER 4 > :redo 2 (* 3 4) 12 

Let re-interaction 2, but with division instead of multiplication:

 CL-USER 5 > :use / * 2 (/ 3 4) 3/4 

Other implementations with extensions such as commands, output histories, or similar functions, such as Allegro CL and Clozure CL.

SLIME, which provides a common GNU Emacs-based Lisp development environment, also provides an advanced REPL .

+3
source

Source: https://habr.com/ru/post/1388913/


All Articles