Just as Readline helps you to reuse a previous input line, value
history allows you to use the result of a previous evaluation
in a new expression. When value history is enabled, each evaluation
result is automatically assigned to the next in the sequence of
variables $1
, $2
, ..., and you can then use these
variables in subsequent expressions.
guile> (iota 10) $1 = (0 1 2 3 4 5 6 7 8 9) guile> (apply * (cdr $1)) $2 = 362880 guile> (sqrt $2) $3 = 602.3952191045344 guile> (cons $2 $1) $4 = (362880 0 1 2 3 4 5 6 7 8 9)
To enable value history, type (use-modules (ice-9 history))
at
the Guile prompt, or add this to your .guile file. (It is not
enabled by default, to avoid the possibility of conflicting with some
other use you may have for the variables $1
, $2
,
..., and also because it prevents the stored evaluation results
from being garbage collected, which some people may not want.)