From 16df0c9f84846d86929c619ab75c516ddd0605b0 Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Sun, 10 Feb 2019 22:38:10 +0000 Subject: [PATCH] Convert multi-LETREC to internal definitions in rfc2822-headers.scm. --- src/runtime/rfc2822-headers.scm | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) 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 -- 2.25.1