Node:Value History, Next:, Previous:Readline Support, Up:Top

41 Value History

Another module which makes command line usage more convenient is (ice-9 history). This module will change the REPL so that each value which is evaluated and printed will be remembered under a name constructed from the dollar character ($) and the number of the evaluated expression.

Consider an example session.

guile> (use-modules (ice-9 history))
guile> 1
$1 = 1
guile> (+ $1 $1)
$2 = 2
guile> (* $2 $2)
$3 = 4

After loading the value history module (ice-9 history), one (trivial) expression is evaluated. The result is stored into the variable $1. This fact is indicated by the output $1 = , which is also caused by (ice-9 history). In the next line, this variable is used two times, to produce the value $2, which in turn is used in the calculation for $3.