* srfi-8.scm: removed in favor of srfi/srfi-8.scm - (wasn't ever
[bpt/guile.git] / ice-9 / history.scm
CommitLineData
870777d7
KN
1;;;; Copyright (C) 2000 Free Software Foundation, Inc.
2;;;;
3;;;; This program is free software; you can redistribute it and/or modify
4;;;; it under the terms of the GNU General Public License as published by
5;;;; the Free Software Foundation; either version 2, or (at your option)
6;;;; any later version.
7;;;;
8;;;; This program is distributed in the hope that it will be useful,
9;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
10;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11;;;; GNU General Public License for more details.
12;;;;
13;;;; You should have received a copy of the GNU General Public License
14;;;; along with this software; see the file COPYING. If not, write to
15;;;; the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
16;;;; Boston, MA 02111-1307 USA
17;;;;
18\f
19;;;; A simple value history support
20
21(define-module (ice-9 history))
22
b727d0bd
KN
23(process-define-module '((value-history)))
24
870777d7
KN
25(define (use-value-history x)
26 (module-use! (current-module)
27 (resolve-module '(value-history))))
28
29(define save-value-history
30 (let ((count 0)
31 (history (resolve-module '(value-history))))
32 (lambda (v)
33 (if (not (unspecified? v))
34 (let* ((c (1+ count))
35 (s (string->symbol (simple-format #f "$~A" c))))
36 (simple-format #t "~A = " s)
37 (module-define! history s v)
38 (set! count c))))))
39
40(add-hook! before-eval-hook use-value-history)
41(add-hook! before-print-hook save-value-history)