(C) REPL Extensions

Abstract

Inlab Scheme drops into an interactive REPL (Read-Eval-Print-Loop) when called with no further arguments. Within this REPL, there are a few procedures available which allow access, editing and re-execution of previously entered commands and expressions. These procedures are summarised in this chapter, ordered alphabetically.

REPL Handling Procedures

!

This procedure allows either to edit and re-execute the last expression entered in interactive mode (entering (!) ) or a selected expression referenced by its number (entering e.g. (! 2) ).

The editor in the variable the-current-editor is invoked to edit the expression.

Example (invoking an external editor at [4]):

[1] (define a 1)
a
[2] (set! a (+ a 1))
a
[3] a
2
[4] (! 2)
ok
[5] a
3
[6]

!!

(!!) repeats the previous entered expression by re-evaluating it in interactive mode of Inlab Scheme and returns the result of this evaluation.

(!! <expression-no>) repeats the previous entered expression with the given expression number by reevaluating it and returns the result of the evaluation.

Example:

[1] (define a 1)
a
[2] (set! a (+ a 1))
a
[3] (!!)
a
[4] a
3
[5]

?

This procedure is used with no arguments only in interactive mode to display the content of the current history. The history is keeping the last 20 expressions entered in interactive mode.

Example:

[1] (define a 1)
a
[2] (+ a 1)
2
[3] (?)

   [1]: (define a 1)
   [2]: (+ a 1)
   [3]: (?)
ok
[4]