From bad3ca37628d637eaeabc96680012e95711b59d3 Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Tue, 8 Jul 2025 00:45:31 +0000 Subject: [PATCH 1/9] Fix 3 occurrences of `map-to-for` This `map` operation can be replaced with a `for/list` loop. --- scribble-lib/scribble/run.rkt | 35 +++++++++++++++----------------- scribble-lib/scribble/srcdoc.rkt | 15 +++++++------- 2 files changed, 23 insertions(+), 27 deletions(-) diff --git a/scribble-lib/scribble/run.rkt b/scribble-lib/scribble/run.rkt index 22eb7aeaa2..efe62b056a 100644 --- a/scribble-lib/scribble/run.rkt +++ b/scribble-lib/scribble/run.rkt @@ -171,21 +171,19 @@ (make-compilation-manager-load/use-compiled-handler))]) (parameterize ([current-command-line-arguments (list->vector (reverse (doc-command-line-arguments)))]) - (build-docs (map (lambda (file) - (define (go) - (let ([mp (if (current-lib-mode) - `(lib ,file) - `(file ,file))]) - ;; Try `doc' submodule, first: - (if (module-declared? `(submod ,mp ,doc-binding) #t) - (dynamic-require `(submod ,mp ,doc-binding) - doc-binding) - (dynamic-require mp doc-binding)))) - (if maker - (parameterize ([current-load/use-compiled maker]) - (go)) - (go))) - files) + (build-docs (for/list ([file (in-list files)]) + (define (go) + (let ([mp (if (current-lib-mode) + `(lib ,file) + `(file ,file))]) + ;; Try `doc' submodule, first: + (if (module-declared? `(submod ,mp ,doc-binding) #t) + (dynamic-require `(submod ,mp ,doc-binding) doc-binding) + (dynamic-require mp doc-binding)))) + (if maker + (parameterize ([current-load/use-compiled maker]) + (go)) + (go))) files))))) (define (build-docs docs files) @@ -193,10 +191,9 @@ ((length files) . > . 1)) (raise-user-error 'scribble "cannot supply a destination name with multiple inputs")) (render docs - (map (lambda (fn) - (let-values ([(base name dir?) (split-path fn)]) - (or (current-dest-name) name))) - files) + (for/list ([fn (in-list files)]) + (define-values (base name dir?) (split-path fn)) + (or (current-dest-name) name)) #:dest-dir (current-dest-directory) #:render-mixin (current-render-mixin) #:image-preferences (reverse (current-image-prefs)) diff --git a/scribble-lib/scribble/srcdoc.rkt b/scribble-lib/scribble/srcdoc.rkt index 7143a61cc1..95b2be9d31 100644 --- a/scribble-lib/scribble/srcdoc.rkt +++ b/scribble-lib/scribble/srcdoc.rkt @@ -75,14 +75,13 @@ (syntax-shift-phase-level s #f))) (with-syntax ([((req ...) ...) (for/list ([rs (in-list (reverse requires))]) - (map (lambda (r) - (syntax-case r () - [(op arg ...) - (with-syntax ([(arg ...) (map shift-and-introduce - (syntax->list #'(arg ...)))]) - #'(op arg ...))] - [else (shift-and-introduce r)])) - (syntax->list rs)))] + (for/list ([r (in-list (syntax->list rs))]) + (syntax-case r () + [(op arg ...) + (with-syntax ([(arg ...) (map shift-and-introduce + (syntax->list #'(arg ...)))]) + #'(op arg ...))] + [else (shift-and-introduce r)])))] [(expr ...) (map shift-and-introduce (reverse doc-exprs))] [doc-body From 0b9caa8a99a1078fa0d0dd4a491b2b369d4fc043 Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Tue, 8 Jul 2025 00:45:31 +0000 Subject: [PATCH 2/9] Fix 6 occurrences of `let-to-define` Internal definitions are recommended instead of `let` expressions, to reduce nesting. --- scribble-lib/scribble/run.rkt | 23 +++--- scribble-lib/scribble/srcdoc.rkt | 95 ++++++++++++++----------- scribble-lib/scribble/text-render.rkt | 20 +++--- scribble-test/tests/scribble/reader.rkt | 12 ++-- 4 files changed, 78 insertions(+), 72 deletions(-) diff --git a/scribble-lib/scribble/run.rkt b/scribble-lib/scribble/run.rkt index efe62b056a..f5d60b78d3 100644 --- a/scribble-lib/scribble/run.rkt +++ b/scribble-lib/scribble/run.rkt @@ -37,10 +37,9 @@ (define current-image-prefs (make-parameter null)) ; reverse order (define (read-one str) - (let ([i (open-input-string str)]) - (with-handlers ([exn:fail:read? (lambda (x) #f)]) - (let ([v (read i)]) - (and (eof-object? (read i)) v))))) + (define i (open-input-string str)) + (with-handlers ([exn:fail:read? (lambda (x) #f)]) + (let ([v (read i)]) (and (eof-object? (read i)) v)))) (define (run) (define doc-binding 'doc) @@ -209,13 +208,15 @@ #:quiet? (current-quiet) #:info-in-files (reverse (current-info-input-files)) #:xrefs (for/list ([mod+id (in-list (reverse (current-xref-input-modules)))]) - (let* ([get-xref (dynamic-require (car mod+id) (cdr mod+id))] - [xr (get-xref)]) - (unless (xref? xr) - (raise-user-error - 'scribble "result from `~s' of `~s' is not an xref: ~e" - (cdr mod+id) (car mod+id) xr)) - xr)) + (define get-xref (dynamic-require (car mod+id) (cdr mod+id))) + (define xr (get-xref)) + (unless (xref? xr) + (raise-user-error 'scribble + "result from `~s' of `~s' is not an xref: ~e" + (cdr mod+id) + (car mod+id) + xr)) + xr) #:info-out-file (current-info-output-file))) (run) diff --git a/scribble-lib/scribble/srcdoc.rkt b/scribble-lib/scribble/srcdoc.rkt index 95b2be9d31..e8d49ddfd8 100644 --- a/scribble-lib/scribble/srcdoc.rkt +++ b/scribble-lib/scribble/srcdoc.rkt @@ -127,11 +127,12 @@ (let ([t (syntax-local-value #'id (lambda () #f))]) (unless (provide/doc-transformer? t) (raise-syntax-error #f "not bound as a provide/doc transformer" stx #'id)) - (let* ([i (make-syntax-introducer)] - [i2 (lambda (x) (syntax-local-introduce (i x)))]) - (let-values ([(p/c d req/d id) ((provide/doc-transformer-proc t) - (i (syntax-local-introduce form)))]) - (list (i2 p/c) (i req/d) (i d) (i id)))))] + (define i (make-syntax-introducer)) + (define (i2 x) + (syntax-local-introduce (i x))) + (let-values ([(p/c d req/d id) ((provide/doc-transformer-proc t) + (i (syntax-local-introduce form)))]) + (list (i2 p/c) (i req/d) (i d) (i id))))] [_ (raise-syntax-error #f "not a provide/doc sub-form" stx form)]))]) (with-syntax ([(p/c ...) (map (lambda (form f) @@ -344,44 +345,52 @@ (let ([build-mandatories/optionals (λ (names contracts extras) - (let ([names-length (length names)] - [contracts-length (length contracts)]) - (let loop ([contracts contracts] - [names names] - [extras extras]) - (cond - [(and (null? names) (null? contracts)) '()] - [(or (null? names) (null? contracts)) - (raise-syntax-error #f - (format "mismatched ~a argument list count and domain contract count (~a)" - (if extras "optional" "mandatory") - (if (null? names) - "ran out of names" - "ran out of contracts")) - stx)] - [else - (let ([fst-name (car names)] - [fst-ctc (car contracts)]) - (if (keyword? (syntax-e fst-ctc)) - (begin - (unless (pair? (cdr contracts)) - (raise-syntax-error #f - "keyword not followed by a contract" - stx)) - (cons (if extras - (list fst-ctc fst-name (cadr contracts) (car extras)) - (list fst-ctc fst-name (cadr contracts))) - (loop (cddr contracts) - (cdr names) - (if extras - (cdr extras) - extras)))) - (cons (if extras - (list fst-name fst-ctc (car extras)) - (list fst-name fst-ctc)) - (loop (cdr contracts) (cdr names) (if extras - (cdr extras) - extras)))))]))))]) + (length names) + (length contracts) + (let loop ([contracts contracts] + [names names] + [extras extras]) + (cond + [(and (null? names) (null? contracts)) '()] + [(or (null? names) (null? contracts)) + (raise-syntax-error + #f + (format + "mismatched ~a argument list count and domain contract count (~a)" + (if extras "optional" "mandatory") + (if (null? names) + "ran out of names" + "ran out of contracts")) + stx)] + [else + (let ([fst-name (car names)] + [fst-ctc (car contracts)]) + (if (keyword? (syntax-e fst-ctc)) + (begin + (unless (pair? (cdr contracts)) + (raise-syntax-error + #f + "keyword not followed by a contract" + stx)) + (cons (if extras + (list fst-ctc + fst-name + (cadr contracts) + (car extras)) + (list fst-ctc fst-name (cadr contracts))) + (loop (cddr contracts) + (cdr names) + (if extras + (cdr extras) + extras)))) + (cons (if extras + (list fst-name fst-ctc (car extras)) + (list fst-name fst-ctc)) + (loop (cdr contracts) + (cdr names) + (if extras + (cdr extras) + extras)))))])))]) #`([(id #,@(build-mandatories/optionals (syntax->list #'(mandatory-names ...)) (syntax->list #'(mandatory ...)) diff --git a/scribble-lib/scribble/text-render.rkt b/scribble-lib/scribble/text-render.rkt index e524ea5f17..dd23b0621b 100644 --- a/scribble-lib/scribble/text-render.rkt +++ b/scribble-lib/scribble/text-render.rkt @@ -37,18 +37,14 @@ (define/override (render-part d ht) (let ([number (collected-info-number (part-collected-info d ht))]) (unless (part-style? d 'hidden) - (let ([s (format-number number '() #t)]) - (unless (null? s) - (printf "~a~a" - (car s) - (if (part-title-content d) - " " - ""))) - (when (part-title-content d) - (render-content (part-title-content d) d ht)) - (when (or (pair? number) (part-title-content d)) - (newline) - (newline)))) + (define s (format-number number '() #t)) + (unless (null? s) + (printf "~a~a" (car s) (if (part-title-content d) " " ""))) + (when (part-title-content d) + (render-content (part-title-content d) d ht)) + (when (or (pair? number) (part-title-content d)) + (newline) + (newline))) (render-flow (part-blocks d) d ht #f) (let loop ([pos 1] [secs (part-parts d)] diff --git a/scribble-test/tests/scribble/reader.rkt b/scribble-test/tests/scribble/reader.rkt index ed0627b692..935a900a70 100644 --- a/scribble-test/tests/scribble/reader.rkt +++ b/scribble-test/tests/scribble/reader.rkt @@ -949,12 +949,12 @@ END-OF-TESTS (regexp-match #px"^(.*\\S)\\s+(-\\S+->)\\s+(\\S.*)$" t))) (unless (and m (= 4 (length m))) (error 'bad-test "~a" t)) - (let-values ([(x y) ((string->tester (caddr m)) (cadr m) (cadddr m))]) - (test #:failure-message (format "bad result in\n ~a\n results:\n ~s != ~s" - (regexp-replace* #rx"\n" t "\n ") - x - y) - (matching? x y)))))) + (define-values (x y) ((string->tester (caddr m)) (cadr m) (cadddr m))) + (test #:failure-message (format "bad result in\n ~a\n results:\n ~s != ~s" + (regexp-replace* #rx"\n" t "\n ") + x + y) + (matching? x y))))) ;; Check static versus dynamic readtable for command (dynamic when "c" in the ;; name) and datum (dynamic when "d" in the name) parts: From 68677547c00c0ccaeedc6126872caf93186f2daf Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Tue, 8 Jul 2025 00:45:31 +0000 Subject: [PATCH 3/9] Fix 2 occurrences of `for-each-to-for` This `for-each` operation can be replaced with a `for` loop. --- scribble-lib/scribble/srcdoc.rkt | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/scribble-lib/scribble/srcdoc.rkt b/scribble-lib/scribble/srcdoc.rkt index e8d49ddfd8..66852d8b5e 100644 --- a/scribble-lib/scribble/srcdoc.rkt +++ b/scribble-lib/scribble/srcdoc.rkt @@ -412,19 +412,22 @@ [((x y) ...) (andmap identifier? (syntax->list #'(x ... y ...)))] [((x y) ...) - (for-each - (λ (var) - (unless (identifier? var) - (raise-syntax-error #f "expected an identifier in the optional names" stx var))) - (syntax->list #'(x ... y ...)))] + (for ([var (in-list (syntax->list #'(x ... y ...)))]) + (unless (identifier? var) + (raise-syntax-error + #f + "expected an identifier in the optional names" + stx + var)))] [(a ...) - (for-each - (λ (a) - (syntax-case stx () - [(x y) (void)] - [other - (raise-syntax-error #f "expected an sequence of two idenfiers" stx #'other)])) - (syntax->list #'(a ...)))]))] + (for ([a (in-list (syntax->list #'(a ...)))]) + (syntax-case stx () + [(x y) (void)] + [other + (raise-syntax-error #f + "expected an sequence of two idenfiers" + stx + #'other)]))]))] [x (raise-syntax-error #f From 682b83405639a2d3b6aa8a7d5b8963750d25c010 Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Tue, 8 Jul 2025 00:45:31 +0000 Subject: [PATCH 4/9] Fix 1 occurrence of `for/fold-result-keyword` Only one of the `for/fold` expression's result values is used. Use the `#:result` keyword to return just that result. --- scribble-lib/scribble/text-render.rkt | 184 ++++++++++++++------------ 1 file changed, 97 insertions(+), 87 deletions(-) diff --git a/scribble-lib/scribble/text-render.rkt b/scribble-lib/scribble/text-render.rkt index dd23b0621b..054f8f8438 100644 --- a/scribble-lib/scribble/text-render.rkt +++ b/scribble-lib/scribble/text-render.rkt @@ -84,88 +84,95 @@ (regexp-replace #rx"\n$" (get-output-string o) ""))))) flows)) flowss)] - [extract-align - (lambda (s) - (define p (style-properties s)) - (cond - [(member 'right p) 'right] - [(member 'center p) 'center] - [else 'left]))] + [extract-align (lambda (s) + (define p (style-properties s)) + (cond + [(member 'right p) 'right] + [(member 'center p) 'center] + [else 'left]))] [alignss (cond - [(ormap (lambda (v) (and (table-cells? v) v)) (style-properties (table-style i))) - => (lambda (tc) - (for/list ([l (in-list (table-cells-styless tc))]) - (for/list ([s (in-list l)]) - (extract-align s))))] - [(ormap (lambda (v) (and (table-columns? v) v)) (style-properties (table-style i))) - => (lambda (tc) - (make-list - (length flowss) - (for/list ([s (in-list (table-columns-styles tc))]) - (extract-align s))))] - [else - (if (null? flowss) - null - (make-list (length flowss) (make-list (length (car flowss)) 'left)))])] - [extract-border - (lambda (s) - (define p (style-properties s)) - (cond - [(memq 'border p) '#(#t #t #t #t)] - [else - (vector (memq 'left-border p) (memq 'right-border p) - (memq 'top-border p) (memq 'bottom-border p))]))] - [borderss - ;; A border is (vector left? right? top? bottom?) - (cond - [(ormap (lambda (v) (and (table-cells? v) v)) (style-properties (table-style i))) - => (lambda (tc) - (for/list ([l (in-list (table-cells-styless tc))]) - (for/list ([s (in-list l)]) - (extract-border s))))] - [(ormap (lambda (v) (and (table-columns? v) v)) (style-properties (table-style i))) - => (lambda (tc) - (make-list - (length flowss) - (for/list ([s (in-list (table-columns-styles tc))]) - (extract-border s))))] - [else - (if (null? flowss) - null - (make-list (length flowss) (make-list (length (car flowss)) '#(#f #f #f #f))))])] + [(ormap (lambda (v) (and (table-cells? v) v)) (style-properties (table-style i))) + => + (lambda (tc) + (for/list ([l (in-list (table-cells-styless tc))]) + (for/list ([s (in-list l)]) + (extract-align s))))] + [(ormap (lambda (v) (and (table-columns? v) v)) + (style-properties (table-style i))) + => + (lambda (tc) + (make-list (length flowss) + (for/list ([s (in-list (table-columns-styles tc))]) + (extract-align s))))] + [else + (if (null? flowss) + null + (make-list (length flowss) (make-list (length (car flowss)) 'left)))])] + [extract-border (lambda (s) + (define p (style-properties s)) + (cond + [(memq 'border p) '#(#t #t #t #t)] + [else + (vector (memq 'left-border p) + (memq 'right-border p) + (memq 'top-border p) + (memq 'bottom-border p))]))] + ;; A border is (vector left? right? top? bottom?) + [borderss (cond + [(ormap (lambda (v) (and (table-cells? v) v)) + (style-properties (table-style i))) + => + (lambda (tc) + (for/list ([l (in-list (table-cells-styless tc))]) + (for/list ([s (in-list l)]) + (extract-border s))))] + [(ormap (lambda (v) (and (table-columns? v) v)) + (style-properties (table-style i))) + => + (lambda (tc) + (make-list (length flowss) + (for/list ([s (in-list (table-columns-styles tc))]) + (extract-border s))))] + [else + (if (null? flowss) + null + (make-list (length flowss) + (make-list (length (car flowss)) '#(#f #f #f #f))))])] [border-left? (lambda (v) (vector-ref v 0))] [border-right? (lambda (v) (vector-ref v 1))] [border-top? (lambda (v) (vector-ref v 2))] [border-bottom? (lambda (v) (vector-ref v 3))] - [col-borders ; has only left and right - (for/list ([i (in-range (length (car borderss)))]) - (for/fold ([v '#(#f #f)]) ([borders (in-list borderss)]) - (define v2 (list-ref borders i)) - (vector (or (border-left? v) (border-left? v2)) - (or (border-right? v) (border-right? v2)))))] + ; has only left and right + [col-borders (for/list ([i (in-range (length (car borderss)))]) + (for/fold ([v '#(#f #f)]) ([borders (in-list borderss)]) + (define v2 (list-ref borders i)) + (vector (or (border-left? v) (border-left? v2)) + (or (border-right? v) (border-right? v2)))))] [widths (map (lambda (col) (for/fold ([d 0]) ([i (in-list col)]) (if (eq? i 'cont) d (apply max d (map string-length i))))) (apply map list strs))] - [x-length (lambda (col) (if (eq? col 'cont) 0 (length col)))]) - + [x-length (lambda (col) + (if (eq? col 'cont) + 0 + (length col)))]) + (define (show-row-border prev-borders borders) (when (for/or ([prev-border (in-list prev-borders)] [border (in-list borders)]) - (or (border-bottom? prev-border) - (border-top? border))) + (or (border-bottom? prev-border) (border-top? border))) (define-values (end-h-border? end-v-border?) (for/fold ([left-border? #f] [prev-border? #f]) - ([w (in-list widths)] - [prev-border (in-list prev-borders)] - [border (in-list borders)] - [col-border (in-list col-borders)]) - (define border? (or (and prev-border (border-bottom? prev-border)) - (border-top? border))) + ([w (in-list widths)] + [prev-border (in-list prev-borders)] + [border (in-list borders)] + [col-border (in-list col-borders)]) + (define border? + (or (and prev-border (border-bottom? prev-border)) (border-top? border))) (when (or left-border? (border-left? col-border)) (display (if (or prev-border? border?) "-" " "))) (display (make-string w (if border? #\- #\space))) @@ -173,35 +180,39 @@ (when end-h-border? (display (if end-v-border? "-" " "))) (newline))) - - (define-values (last-indent? last-borders) - (for/fold ([indent? #f] [prev-borders #f]) ([row (in-list strs)] - [aligns (in-list alignss)] - [borders (in-list borderss)]) + + (define last-borders + (for/fold ([indent? #f] + [prev-borders #f] + #:result prev-borders) + ([row (in-list strs)] + [aligns (in-list alignss)] + [borders (in-list borderss)]) (values (let ([h (apply max 0 (map x-length row))]) (let ([row* (for/list ([i (in-range h)]) (for/list ([col (in-list row)]) (if (i . < . (x-length col)) (list-ref col i) - (if (eq? col 'cont) - 'cont - ""))))]) - (for/fold ([indent? indent?]) ([sub-row (in-list row*)] - [pos (in-naturals)]) - (when indent? (indent)) - + (if (eq? col 'cont) 'cont ""))))]) + (for/fold ([indent? indent?]) + ([sub-row (in-list row*)] + [pos (in-naturals)]) + (when indent? + (indent)) + (when (zero? pos) (show-row-border (or prev-borders (map (lambda (b) '#(#f #f #f #f)) borders)) borders)) - + (define-values (end-border? end-col-border?) - (for/fold ([left-border? #f] [left-col-border? #f]) - ([col (in-list sub-row)] - [w (in-list widths)] - [align (in-list aligns)] - [border (in-list borders)] - [col-border (in-list col-borders)]) + (for/fold ([left-border? #f] + [left-col-border? #f]) + ([col (in-list sub-row)] + [w (in-list widths)] + [align (in-list aligns)] + [border (in-list borders)] + [col-border (in-list col-borders)]) (when (or left-col-border? (border-left? col-border)) (display (if (and (or left-border? (border-left? border)) (not (eq? col 'cont))) @@ -216,16 +227,15 @@ (case align [(left) (display (make-string gap #\space))] [(center) (display (make-string (- gap (quotient gap 2)) #\space))])) - (values (border-right? border) - (border-right? col-border)))) + (values (border-right? border) (border-right? col-border)))) (when end-col-border? (display (if end-border? "|" " "))) (newline) #t))) borders))) - + (show-row-border last-borders (map (lambda (b) '#(#f #f #f #f)) last-borders)) - + null))) (define/override (render-itemization i part ht) From 632075ce9928a6bf1dabb8d4e25bffd9aa7cbf01 Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Tue, 8 Jul 2025 00:45:31 +0000 Subject: [PATCH 5/9] Fix 1 occurrence of `if-begin-to-cond` Using `cond` instead of `if` here makes `begin` unnecessary --- scribble-lib/scribble/text-render.rkt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scribble-lib/scribble/text-render.rkt b/scribble-lib/scribble/text-render.rkt index 054f8f8438..f4e365c88b 100644 --- a/scribble-lib/scribble/text-render.rkt +++ b/scribble-lib/scribble/text-render.rkt @@ -306,12 +306,12 @@ (define/override (render-nested-flow i part ri starting-item?) (define s (nested-flow-style i)) (unless (memq 'decorative (style-properties s)) - (if (and s (or (eq? (style-name s) 'inset) - (eq? (style-name s) 'code-inset))) - (begin (printf " ") - (parameterize ([current-indent (make-indent 2)]) - (super render-nested-flow i part ri starting-item?))) - (super render-nested-flow i part ri starting-item?)))) + (cond + [(and s (or (eq? (style-name s) 'inset) (eq? (style-name s) 'code-inset))) + (printf " ") + (parameterize ([current-indent (make-indent 2)]) + (super render-nested-flow i part ri starting-item?))] + [else (super render-nested-flow i part ri starting-item?)]))) (define/override (render-other i part ht) (cond From 935732c2ddb7dace35a69201abce8f7afeeb8ccd Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Tue, 8 Jul 2025 00:45:31 +0000 Subject: [PATCH 6/9] Fix 1 occurrence of `define-lambda-to-define` The `define` form supports a shorthand for defining functions. --- scribble-lib/scribble/run.rkt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scribble-lib/scribble/run.rkt b/scribble-lib/scribble/run.rkt index f5d60b78d3..a68fe07da9 100644 --- a/scribble-lib/scribble/run.rkt +++ b/scribble-lib/scribble/run.rkt @@ -12,8 +12,8 @@ (module test racket/base) -(define multi-html:render-mixin - (lambda (%) (html:render-multi-mixin (html:render-mixin %)))) +(define (multi-html:render-mixin %) + (html:render-multi-mixin (html:render-mixin %))) (define current-render-mixin (make-parameter html:render-mixin)) (define current-html (make-parameter #t)) From c3cc732421acfa8445f4b02ecd8cc22de602f54a Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Tue, 8 Jul 2025 00:45:31 +0000 Subject: [PATCH 7/9] Fix 4 occurrences of `arrow-contract-with-rest-to-arrow-contract-with-ellipses` This `->*` contract can be rewritten using `->` with ellipses. --- scribble-lib/scribble/acmart.rkt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scribble-lib/scribble/acmart.rkt b/scribble-lib/scribble/acmart.rkt index f75a79e489..5955f428b8 100644 --- a/scribble-lib/scribble/acmart.rkt +++ b/scribble-lib/scribble/acmart.rkt @@ -45,8 +45,8 @@ #:email (or/c pre-content? email? (listof email?))) #:rest (listof pre-content?) block?)] - [authorsaddresses (->* () () #:rest (listof pre-content?) block?)] - [shortauthors (->* () () #:rest (listof pre-content?) element?)] + [authorsaddresses (-> pre-content? ... block?)] + [shortauthors (-> pre-content? ... element?)] [institution (->* () (#:departments (listof (or/c pre-content? institution?))) @@ -67,7 +67,7 @@ #:country (or/c pre-content? #f)) affiliation?)] [affiliation? (-> any/c boolean?)] - [abstract (->* () () #:rest (listof pre-content?) block?)] + [abstract (-> pre-content? ... block?)] [acmConference (-> string? string? string? block?)] [grantsponsor (-> string? string? string? content?)] [grantnum (->* (string? string?) (#:url string?) content?)] @@ -76,7 +76,7 @@ [received (->* (string?) (#:stage string?) block?)] [citestyle (-> content? block?)] [ccsdesc (->* (string?) (#:number exact-integer?) block?)] - [CCSXML (->* () () #:rest (listof pre-content?) any/c)])) + [CCSXML (-> pre-content? ... any/c)])) (provide invisible-element-to-collect-for-acmart-extras include-abstract) From 04218fe9b673b2062c4732dba95e18e9c2eadd09 Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Tue, 8 Jul 2025 00:45:31 +0000 Subject: [PATCH 8/9] Fix 1 occurrence of `for-set!-to-for/fold` `for/fold` can be used instead of a mutating `for` loop --- scribble-test/tests/scribble/reader.rkt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scribble-test/tests/scribble/reader.rkt b/scribble-test/tests/scribble/reader.rkt index 935a900a70..ca7afa903a 100644 --- a/scribble-test/tests/scribble/reader.rkt +++ b/scribble-test/tests/scribble/reader.rkt @@ -847,9 +847,9 @@ END-OF-TESTS (values (read-all x inside-reader #t) (read-all y read))) (define (x . (mk-eval-test syntax-reader) . y) - (define r (void)) - (for ([x (read-all x (lambda (i) (syntax-reader 'test i)))]) - (set! r (call-with-values (lambda () (eval x ns)) list))) + (define r + (for/fold ([r (void)]) ([x (read-all x (lambda (i) (syntax-reader 'test i)))]) + (call-with-values (lambda () (eval x ns)) list))) (values r (read-all y read))) (define (x . (mk-syntax-test syntax-reader) . y) From fdcfa8c41a6317cd337efc9123b96b0b3dc9cab1 Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Tue, 8 Jul 2025 00:45:31 +0000 Subject: [PATCH 9/9] Fix 1 occurrence of `provide-deduplication` Providing the same identifier multiple times is unnecessary. --- scribble-lib/scribble/example.rkt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scribble-lib/scribble/example.rkt b/scribble-lib/scribble/example.rkt index 9f0ccf6dde..3041c00d45 100644 --- a/scribble-lib/scribble/example.rkt +++ b/scribble-lib/scribble/example.rkt @@ -15,8 +15,7 @@ make-log-based-eval scribble-exn->string - scribble-eval-handler - make-log-based-eval) + scribble-eval-handler) (define example-title (make-paragraph (list "Example:")))