From: Taylor R Campbell Date: Sun, 10 Feb 2019 22:38:53 +0000 (+0000) Subject: Convert multi-LETREC to internal definitions in uri.scm. X-Git-Tag: mit-scheme-pucked-10.1.10~6^2~7^2~7 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=b56664d6b2a3388b95881fa2daa5d725012fb10d;p=mit-scheme.git Convert multi-LETREC to internal definitions in uri.scm. --- diff --git a/src/runtime/url.scm b/src/runtime/url.scm index c43339013..fe22a17df 100644 --- a/src/runtime/url.scm +++ b/src/runtime/url.scm @@ -200,45 +200,41 @@ USA. ;; At all times, (APPEND INPUT (REVERSE OUTPUT)) must be well ;; formed. If both INPUT and OUTPUT are non-null, the slash ;; separating them is assumed to be in INPUT. - (letrec - ((no-output - (lambda (input) - (if (pair? input) - (let ((segment (car input)) - (input (cdr input))) - (if (or (string=? segment "..") - (string=? segment ".")) - ;; Rules A and D - (no-output input) - ;; Rule E - (some-output input (list segment)))) - '()))) - (some-output - (lambda (input output) - (if (pair? input) - (let ((segment (car input)) - (input (cdr input))) - (cond ((string=? segment ".") - ;; Rule B - (maybe-done input output)) - ((string=? segment "..") - ;; Rule C - (maybe-done input - (if (pair? (cdr output)) - (cdr output) - (list "")))) - (else - ;; Rule E - (some-output input (cons segment output))))) - output))) - (maybe-done - (lambda (input output) - (if (pair? input) - (some-output input output) - (cons "" output))))) - (if (path-absolute? path) - (reverse! (no-output path)) - path))) + (define (no-output input) + (if (pair? input) + (let ((segment (car input)) + (input (cdr input))) + (if (or (string=? segment "..") + (string=? segment ".")) + ;; Rules A and D + (no-output input) + ;; Rule E + (some-output input (list segment)))) + '())) + (define (some-output input output) + (if (pair? input) + (let ((segment (car input)) + (input (cdr input))) + (cond ((string=? segment ".") + ;; Rule B + (maybe-done input output)) + ((string=? segment "..") + ;; Rule C + (maybe-done input + (if (pair? (cdr output)) + (cdr output) + (list "")))) + (else + ;; Rule E + (some-output input (cons segment output))))) + output)) + (define (maybe-done input output) + (if (pair? input) + (some-output input output) + (cons "" output))) + (if (path-absolute? path) + (reverse! (no-output path)) + path)) ;;;; Merging