From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Greg Hewgill Newsgroups: gmane.lisp.guile.devel Subject: Value history Date: Sun, 4 Aug 2002 22:12:15 -0500 Sender: guile-devel-admin@gnu.org Message-ID: <20020805031214.GA29032@nsx.internal.hewgill.net> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1028517210 27999 127.0.0.1 (5 Aug 2002 03:13:30 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 5 Aug 2002 03:13:30 +0000 (UTC) Return-path: Original-Received: from fencepost.gnu.org ([199.232.76.164]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 17bYJF-0007HN-00 for ; Mon, 05 Aug 2002 05:13:29 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.35 #1 (Debian)) id 17bYJn-00085W-00; Sun, 04 Aug 2002 23:14:03 -0400 Original-Received: from cs6625216-122.austin.rr.com ([66.25.216.122] helo=nsx.internal.hewgill.net) by fencepost.gnu.org with smtp (Exim 3.35 #1 (Debian)) id 17bYJP-00083D-00 for ; Sun, 04 Aug 2002 23:13:39 -0400 Original-Received: (qmail 29389 invoked by uid 500); 5 Aug 2002 03:12:16 -0000 Original-To: guile-devel@gnu.org Content-Disposition: inline User-Agent: Mutt/1.4i X-PGP-Fingerprint: 862C 894D 4908 0240 FEEE 6D1F FA34 8460 74E0 2115 Errors-To: guile-devel-admin@gnu.org X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Developers list for Guile, the GNU extensibility library List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.lisp.guile.devel:974 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:974 I'm a guile newbie and thought it might be interesting to play with some of the low hanging fruit on the "cool ideas" page. This is my first actual useful scheme code, so please be gentle. :) Below is a patch for the "Value history" idea. This diff is against the CVS head. If anybody has any suggestions for improvement, let me know. I get the feeling that the eval statement might not be the best way to do the global $ assignment, but it was the only way I could find to make it work. Greg Hewgill http://www.hewgill.com RCS file: /cvs/guile/guile-core/ice-9/boot-9.scm,v retrieving revision 1.282 diff -c -r1.282 boot-9.scm *** ice-9/boot-9.scm 7 Jul 2002 05:18:16 -0000 1.282 --- ice-9/boot-9.scm 5 Aug 2002 03:06:11 -0000 *************** *** 2282,2287 **** --- 2282,2294 ---- (define before-print-hook (make-hook 1)) (define after-print-hook (make-hook 1)) + ;;; A counter for numbering the results of interactive expressions + ;;; in the repl loop. $$ is always the value of the last printed + ;;; result. $ where is an integer, is created in the -print + ;;; section of the repl loop below. + (define repl-counter 0) + (define $$ #f) + ;;; The default repl-reader function. We may override this if we've ;;; the readline library. (define repl-reader *************** *** 2373,2378 **** --- 2380,2392 ---- (if (or scm-repl-print-unspecified (not (unspecified? result))) (begin + (set! repl-counter (+ repl-counter 1)) + (set! $$ result) + ;; we have to do this with an eval so we can use define + (eval + `(define ,(string->symbol (string-append "$" (number->string repl-counter))) $$) + (interaction-environment)) + (display (string-append "$" (number->string repl-counter) " => ")) (write result) (newline)))))) (lambda (result) _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel