1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 11:50:28 +02:00

update manual for value history on by default

* doc/ref/compiler.texi: Update for new ,pp meta-command.
* doc/ref/scheme-using.texi (Using Guile Interactively): Show value
  history in examples.
  (Value Historyx): Update docs to mention the repl option and the
  programmatic interface.
This commit is contained in:
Andy Wingo 2010-07-10 11:38:47 +02:00
parent c27d140ab4
commit dc3b266118
2 changed files with 44 additions and 10 deletions

View file

@ -709,7 +709,7 @@ to play around with it at the REPL, as can be seen in this annotated
example: example:
@example @example
scheme@@(guile-user)> (pp (compile '(+ 32 10) #:to 'assembly)) scheme@@(guile-user)> ,pp (compile '(+ 32 10) #:to 'assembly)
(load-program (load-program
((:LCASE16 . 2)) ; Labels, unused in this case. ((:LCASE16 . 2)) ; Labels, unused in this case.
8 ; Length of the thunk that was compiled. 8 ; Length of the thunk that was compiled.

View file

@ -15,12 +15,12 @@ simple examples.
@lisp @lisp
scheme@@(guile-user)> (+ 3 4 5) scheme@@(guile-user)> (+ 3 4 5)
12 $1 = 12
scheme@@(guile-user)> (display "Hello world!\n") scheme@@(guile-user)> (display "Hello world!\n")
Hello world! Hello world!
scheme@@(guile-user)> (values 'a 'b) scheme@@(guile-user)> (values 'a 'b)
a $2 = a
b $3 = b
@end lisp @end lisp
@noindent @noindent
@ -83,12 +83,46 @@ scheme@@(guile-user)> (cons $2 $1)
$4 = (362880 0 1 2 3 4 5 6 7 8 9) $4 = (362880 0 1 2 3 4 5 6 7 8 9)
@end lisp @end lisp
To enable value history, type @code{(use-modules (ice-9 history))} at Value history is enabled by default, because Guile's REPL imports the
the Guile prompt, or add this to your @file{.guile} file. (It is not @code{(ice-9 history)} module. Value history may be turned off or on within the
enabled by default, to avoid the possibility of conflicting with some repl, using the options interface:
other use you may have for the variables @code{$1}, @code{$2},
@dots{}, and also because it prevents the stored evaluation results @lisp
from being garbage collected, which some people may not want.) scheme@@(guile-user)> ,option value-history #f
scheme@@(guile-user)> 'foo
foo
scheme@@(guile-user)> ,option value-history #t
scheme@@(guile-user)> 'bar
$5 = bar
@end lisp
Note that previously recorded values are still accessible, even if value history
is off. In rare cases, these references to past computations can cause Guile to
use too much memory. One may clear these values, possibly enabling garbage
collection, via the @code{clear-value-history!} procedure, described below.
The programmatic interface to value history is in a module:
@lisp
(use-modules (ice-9 history))
@end lisp
@deffn {Scheme Procedure} value-history-enabled?
Return true iff value history is enabled.
@end deffn
@deffn {Scheme Procedure} enable-value-history!
Turn on value history, if it was off.
@end deffn
@deffn {Scheme Procedure} disable-value-history!
Turn off value history, if it was on.
@end deffn
@deffn {Scheme Procedure} clear-value-history!
Clear the value history. If the stored values are not captured by some other
data structure or closure, they may then be reclaimed by the garbage collector.
@end deffn
@node Error Handling @node Error Handling