From 144746f81055152a6f70cd304086dc7692d2deb1 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Tue, 23 May 2000 03:55:08 +0000 Subject: [PATCH] Implement procedure to count number of digits in an exact nonnegative integer. --- v7/src/imail/imail-summary.scm | 8 ++------ v7/src/imail/imail-util.scm | 8 +++++++- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/v7/src/imail/imail-summary.scm b/v7/src/imail/imail-summary.scm index cf9ed554a..cb9aa113e 100644 --- a/v7/src/imail/imail-summary.scm +++ b/v7/src/imail/imail-summary.scm @@ -1,6 +1,6 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: imail-summary.scm,v 1.14 2000/05/19 21:10:20 cph Exp $ +;;; $Id: imail-summary.scm,v 1.15 2000/05/23 03:55:06 cph Exp $ ;;; ;;; Copyright (c) 2000 Massachusetts Institute of Technology ;;; @@ -195,11 +195,7 @@ The recipients are specified as a comma-separated list of names." (if (< i end) (loop (+ i 1) (cons (get-message folder i) messages)) (reverse! messages)))) - (index-digits - (let loop ((n 1) (k 10)) - (if (< end k) - n - (loop (+ n 1) (* k 10))))) + (index-digits (exact-nonnegative-integer-digits (- end 1))) (show-date? (ref-variable imail-summary-show-date buffer)) (subject-width (imail-summary-subject-width buffer))) (let ((mark (mark-left-inserting-copy (buffer-start buffer)))) diff --git a/v7/src/imail/imail-util.scm b/v7/src/imail/imail-util.scm index 98196dd43..65b9586f1 100644 --- a/v7/src/imail/imail-util.scm +++ b/v7/src/imail/imail-util.scm @@ -1,6 +1,6 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: imail-util.scm,v 1.24 2000/05/22 03:01:30 cph Exp $ +;;; $Id: imail-util.scm,v 1.25 2000/05/23 03:55:08 cph Exp $ ;;; ;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology ;;; @@ -238,6 +238,12 @@ ((9) "G") ((12) "T"))))))))) +(define (exact-nonnegative-integer-digits n) + (let loop ((j 1) (k 10)) + (if (< n k) + j + (loop (+ j 1) (* k 10))))) + (define (burst-comma-list-string string) (list-transform-negative (map string-trim (burst-string string #\, #f)) string-null?)) -- 2.25.1