From: Taylor R Campbell Date: Sun, 10 Feb 2019 22:38:10 +0000 (+0000) Subject: Convert multi-LETREC to internal definitions in rfc2822-headers.scm. X-Git-Tag: mit-scheme-pucked-10.1.10~6^2~7^2~11 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=16df0c9f84846d86929c619ab75c516ddd0605b0;p=mit-scheme.git Convert multi-LETREC to internal definitions in rfc2822-headers.scm. --- diff --git a/src/runtime/rfc2822-headers.scm b/src/runtime/rfc2822-headers.scm index 39abc440e..2e2bf4da4 100644 --- a/src/runtime/rfc2822-headers.scm +++ b/src/runtime/rfc2822-headers.scm @@ -105,24 +105,21 @@ USA. (define (write-name name port) (let* ((name (symbol->string name)) (end (string-length name))) + (define (start-word i) + (if (fix:< i end) + (begin + (write-char (char-upcase (string-ref name i)) port) + (finish-word (fix:+ i 1))))) + (define (finish-word i) + (if (fix:< i end) + (let ((char (string-ref name i)) + (i (fix:+ i 1))) + (write-char char port) + (if (char=? char #\-) + (start-word i) + (finish-word i))))) (if (char-alphabetic? (string-ref name 0)) - (letrec - ((start-word - (lambda (i) - (if (fix:< i end) - (begin - (write-char (char-upcase (string-ref name i)) port) - (finish-word (fix:+ i 1)))))) - (finish-word - (lambda (i) - (if (fix:< i end) - (let ((char (string-ref name i)) - (i (fix:+ i 1))) - (write-char char port) - (if (char=? char #\-) - (start-word i) - (finish-word i))))))) - (start-word 0)) + (start-word 0) (write-string name port)))) ;;;;; Input