loop question - scheme help needed

Subject: loop question - scheme help needed
From: Bas Peters <bpeters@xxxxxx>
Date: Tue, 8 Jun 1999 13:53:17 +0200
Sorry for this basic Scheme question.

If have the following code:

; removes trailing punctuation for last string character
(define (strip-trailing-punctuation s)
  (let ((sl-1 (- (string-length s) 1)))
    (case (string-ref s sl-1)
      ((#\space #\: #\; #\, #\.) (substring s 0 sl-1))
      (else s))))

(define (*extent*)
  ; Set x to the MRCB300-a content
  (let ((x
	 (data (select-elements (descendants (if (equal? (gi) "MRCB300")
					      (current-node)
					    (ancestor "MRCB300")))
				'(MRCB300-a)))))
                 (strip-trailing-punctuation x)))

What I would like to do is to evaluate string -1 untill the condition is
false. I tried to use let loop, but it seems to evaluate the string only
once. My goal is not only to strip: "bla bla.", but also "bla bla. :"
into "bla bla"

Thanks in advance,

Bas Peters
bpeters@xxxxxx





 DSSSList info and archive:  http://www.mulberrytech.com/dsssl/dssslist


Current Thread