Convert multi-LETREC to internal definitions in rfc2822-headers.scm.
authorTaylor R Campbell <campbell@mumble.net>
Sun, 10 Feb 2019 22:38:10 +0000 (22:38 +0000)
committerTaylor R Campbell <campbell@mumble.net>
Sun, 10 Feb 2019 22:38:10 +0000 (22:38 +0000)
src/runtime/rfc2822-headers.scm

index 39abc440e89075329d0a63377a3e50c77e83b566..2e2bf4da4fe1082f4544bd7a615d82f39209da2f 100644 (file)
@@ -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))))
 \f
 ;;;;; Input