From: Taylor R Campbell Date: Sun, 10 Feb 2019 22:39:49 +0000 (+0000) Subject: Convert multi-LETREC to internal definitions in edwin/string.scm. X-Git-Tag: mit-scheme-pucked-10.1.10~6^2~7^2~4 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=b51010e654862b74290bfb7403e80cd3925a7a2b;p=mit-scheme.git Convert multi-LETREC to internal definitions in edwin/string.scm. --- diff --git a/src/edwin/string.scm b/src/edwin/string.scm index 3eea2d925..90b21b511 100644 --- a/src/edwin/string.scm +++ b/src/edwin/string.scm @@ -747,31 +747,27 @@ USA. ;; lower case or capitalized. This is a very general definition of ;; capitalization; if you need something more specific you should ;; call this procedure on the individual words. - (letrec - ((find-first-word - (lambda (start) - (and (fix:< start end) - (let ((char (string-ref string start))) - (if (char-upper-case? char) - (scan-word-tail (fix:+ start 1)) - (and (not (char-lower-case? char)) - (find-first-word (fix:+ start 1)))))))) - (scan-word-tail - (lambda (start) - (or (fix:= start end) - (let ((char (string-ref string start))) - (if (char-lower-case? char) - (scan-word-tail (fix:+ start 1)) - (and (not (char-upper-case? char)) - (find-subsequent-word (fix:+ start 1)))))))) - (find-subsequent-word - (lambda (start) - (or (fix:= start end) - (let ((char (string-ref string start))) - (if (char-alphabetic? char) - (scan-word-tail (fix:+ start 1)) - (find-subsequent-word (fix:+ start 1)))))))) - (find-first-word start))) + (define (find-first-word start) + (and (fix:< start end) + (let ((char (string-ref string start))) + (if (char-upper-case? char) + (scan-word-tail (fix:+ start 1)) + (and (not (char-lower-case? char)) + (find-first-word (fix:+ start 1))))))) + (define (scan-word-tail start) + (or (fix:= start end) + (let ((char (string-ref string start))) + (if (char-lower-case? char) + (scan-word-tail (fix:+ start 1)) + (and (not (char-upper-case? char)) + (find-subsequent-word (fix:+ start 1))))))) + (define (find-subsequent-word start) + (or (fix:= start end) + (let ((char (string-ref string start))) + (if (char-alphabetic? char) + (scan-word-tail (fix:+ start 1)) + (find-subsequent-word (fix:+ start 1)))))) + (find-first-word start)) (define (string-capitalize string) (guarantee-string string 'STRING-CAPITALIZE)