diff options
| author | Rose Hogenson <rhogenson@google.com> | 2022-07-12 22:55:12 -0700 |
|---|---|---|
| committer | Rose Hogenson <rhogenson@google.com> | 2022-07-12 22:55:12 -0700 |
| commit | d9a651a17e4abb63a24b764f6a850a0df74bd156 (patch) | |
| tree | 480ca4624bceb9f8588dbd4d756ad7101c32d81d /csc/compare.csc | |
| parent | Remove redundant parentheses in the match macro. (diff) | |
| download | chromatopelma-d9a651a17e4abb63a24b764f6a850a0df74bd156.tar.zst | |
Slightly improve diff formatting.
Diffstat (limited to 'csc/compare.csc')
| -rw-r--r-- | csc/compare.csc | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/csc/compare.csc b/csc/compare.csc index cbf8b6d..ab7e3c1 100644 --- a/csc/compare.csc +++ b/csc/compare.csc @@ -77,17 +77,17 @@ (define (pretty w x indent) (cond ((list? x) - (fprintf w "{}(\n" indent) + (fprintf w "{} (\n" indent) (loop with new-indent = (string-append indent " ") for v in x do (pretty w v new-indent)) - (fprintf w "{})\n" indent)) + (fprintf w "{} )\n" indent)) ((and (pair? x) (symbol? (car x))) - (fprintf w "{}({} .\n" indent (car x)) + (fprintf w "{} ({} .\n" indent (car x)) (pretty w (cdr x) (string-append indent " ")) - (fprintf w "{})\n" indent)) - (else (fprintf w "{}{}\n" indent x)))) + (fprintf w "{} )\n" indent)) + (else (fprintf w "{} {}\n" indent x)))) (define (diff* w x y indent) @@ -99,13 +99,13 @@ (and (string? x) (string? y))) (if (equal? x y) (begin - (fprintf w "{} {}\n" indent x) + (fprintf w "{} {}\n" indent x) #t) (begin - (fprintf w "{}-{}\n{}+{}\n" indent x indent y) + (fprintf w "{}- {}\n{}+ {}\n" indent x indent y) #f))) ((and (alist? x) (alist? y)) - (fprintf w "{} (\n" indent) + (fprintf w "{} (\n" indent) (let ((key-lcs (lcs (map car x) (map car y) symbol=?)) (indent* (string-append indent " ")) (equal #t)) @@ -123,10 +123,10 @@ (set! equal #f) else if (symbol=? (caar x) (caar y) (car key-lcs)) - do (fprintf w "{} ({} .\n" indent* (car key-lcs)) + do (fprintf w "{} ({} .\n" indent* (car key-lcs)) (set! equal (and (diff* w (cdar x) (cdar y) (string-append indent* " ")) equal)) - (fprintf w "{} )\n" indent*) + (fprintf w "{} )\n" indent*) (set! x (cdr x)) (set! y (cdr y)) (set! key-lcs (cdr key-lcs)) @@ -138,10 +138,10 @@ do (pretty w (car x) (string-append indent* "-")) (set! x (cdr x)) (set! equal #f)) - (fprintf w "{} )\n" indent) + (fprintf w "{} )\n" indent) equal)) ((and (list? x) (list? y)) - (fprintf w "{} (\n" indent) + (fprintf w "{} (\n" indent) (let* ((common (lcs x y equal?)) (indent* (string-append indent " ")) (equal #t)) @@ -181,7 +181,7 @@ (set! x (cdr x)) (set! y (cdr y)) (set! equal #f)) - (fprintf w "{} )\n" indent) + (fprintf w "{} )\n" indent) equal)))) |
