Skip to content

Conversation

@resyntax-ci
Copy link
Contributor

@resyntax-ci resyntax-ci bot commented Jan 11, 2026

Resyntax fixed 20 issues in 7 files.

  • Fixed 5 occurrences of unless-expression-in-for-loop-to-unless-keyword
  • Fixed 4 occurrences of let-to-define
  • Fixed 2 occurrences of list-element-definitions-to-match-define
  • Fixed 2 occurrences of for-each-to-for
  • Fixed 2 occurrences of map-to-for
  • Fixed 2 occurrences of when-expression-in-for-loop-to-when-keyword
  • Fixed 1 occurrence of and-let-to-cond
  • Fixed 1 occurrence of named-let-loop-to-for-in-range
  • Fixed 1 occurrence of define-begin-extraction

resyntax-ci bot added 5 commits January 16, 2026 08:02
These list element variable definitions can be expressed more succinctly with `match-define`. Note that the suggested replacement raises an error if the list contains more elements than expected.
The `begin` in this definition can be extracted into the surrounding definition context.
This `for-each` operation can be replaced with a `for` loop.
Internal definitions are recommended instead of `let` expressions, to reduce nesting.
Using `cond` allows converting `let` to internal definitions, reducing nesting
@rfindler
Copy link
Member

I rebased on master and just dropped commits that had conflicts.

@rfindler rfindler merged commit 50b85cf into master Jan 16, 2026
3 checks passed
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resyntax analyzed 3 files in this pull request and has added suggestions.

Comment on lines +139 to +141
(let ([res (syntax->datum stx)])
(hash-set! ht res stx)
res)]))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cond-let-to-cond-define: Internal definitions are recommended instead of let expressions, to reduce nesting.

Suggested change
(let ([res (syntax->datum stx)])
(hash-set! ht res stx)
res)]))
(define res (syntax->datum stx))
(hash-set! ht res stx)
res]))
Debugging details
Textual replacement
(line-replacement
  #:new-lines
    '#("                 (define res (syntax->datum stx))"
       "                 (hash-set! ht res stx)"
       "                 res]))")
  #:original-lines
    '#("                 (let ([res (syntax->datum stx)])"
       "                   (hash-set! ht res stx)"
       "                   res)]))")
  #:start-line 139)
Syntactic replacement
(syntax-replacement
  #:introduction-scope #<procedure:...and/syntax-local.rkt:148:2>
  #:new-syntax
    #<syntax:/home/runner/.local/share/racket/9.1.0.1/pkgs/resyntax/default-recommendations/let-replacement/cond-let-replacement.rkt:36:2 (cond ((list? obj) (let ((res (map loop obj))) (hash-set! ht res stx) res)) ((pair? obj) (let ((res (cons (loop (car obj)) (loop (cdr obj))))) (hash-set! ht res stx) res)) ((vector? obj) (let ((res (list->vector (map loop (vector->list obj))))) (hash-se...>
  #:original-syntax
    #<syntax:drracket-core-lib/drracket/private/syncheck-debug.rkt:125:14 (cond ((list? obj) (let ((res (map loop obj))) (hash-set! ht res stx) res)) ((pair? obj) (let ((res (cons (loop (car obj)) (loop (cdr obj))))) (hash-set! ht res stx) res)) ((vector? obj) (let ((res (list->vector (map loop (vector->list obj))))) (hash-se...>
  #:source
    (file-source
     #<path:/home/runner/work/drracket/drracket/drracket-core-lib/drracket/private/syncheck-debug.rkt>)
  #:uses-universal-tagged-syntax? #f)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant