Kos
Kos

Reputation: 72241

What are the magic variables in CLISP's REPL?

I have noticed that when I type an operator in REPL, it is often expanded into a value which has something to do with the input/output history.

Specifically I noticed that:

There apparently are more (/ expands to something but I haven't figured it out exactly).

I've tried browsing the clisp docs, but unsuccessfully.

My questions:

Upvotes: 6

Views: 487

Answers (2)

Rainer Joswig
Rainer Joswig

Reputation: 139261

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

In addition to that a Common Lisp implementation may have lots of other features. A full featured top-level with user interface is often called a 'Lisp listener'.

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

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

Interaction number 2, in the CL-USER package:

CL-USER 2 > (* 3 4)
12

The same, but we can omit the outer parentheses:

CL-USER 3 > * 3 4
12

Let's redo interaction 2:

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

Let's redo interaction 2, but with division instead of multiplication:

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

Other implementations with extensions like commands, output histories, or similar features are for example Allegro CL and Clozure CL.

SLIME, which provides a Common Lisp development environment based on GNU Emacs, also provides an extended REPL.

Upvotes: 4

Ramarren
Ramarren

Reputation: 2520

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

Upvotes: 8

Related Questions