Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated Resyntax fixes #718

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Automated Resyntax fixes #718

wants to merge 8 commits into from

Conversation

resyntax-ci[bot]
Copy link
Contributor

@resyntax-ci resyntax-ci bot commented Feb 16, 2025

Resyntax fixed 20 issues in 5 files.

  • Fixed 13 occurrences of let-to-define
  • Fixed 1 occurrence of send-chain-to-send+
  • Fixed 1 occurrence of if-begin-to-cond
  • Fixed 1 occurrence of nested-if-to-cond
  • Fixed 1 occurrence of cond-let-to-cond-define
  • Fixed 1 occurrence of hash-ref-with-constant-lambda-to-hash-ref-without-lambda
  • Fixed 1 occurrence of zero-comparison-to-positive?
  • Fixed 1 occurrence of if-let-to-cond

Internal definitions are recommended instead of `let` expressions, to reduce nesting.
`cond` with internal definitions is preferred over `if` with `let`, to reduce nesting
…t-lambda`

The lambda can be removed from the failure result in this `hash-ref` expression.
Internal definitions are recommended instead of `let` expressions, to reduce nesting.
This method chain made of nested `send` expressions can be written more clearly as a `send+` expression.
This `if`-`else` chain can be converted to a `cond` expression.
Using `cond` instead of `if` here makes `begin` unnecessary
This expression is equivalent to calling the `positive?` predicate.
(let ([y (node-y (node-parent p))])
(if (and y (eq? 'red (node-color y)))
(recolor-k y)
(let ([k (lambda (node)
(rotate-k always-rotate node))])
(let ([k (lambda (node) (rotate-k always-rotate node))])
(if (eq? node (node-y p))
Copy link
Member

Choose a reason for hiding this comment

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

In this region (recolor-k, rotate-k, and k), why didn't the lets turn into defines? It looks like the main change here is reformatting?

(cond
[(<= pos npos) (loop (node-left n) n npos v)]
[(or (not so-far-pos) (> npos so-far-pos)) (loop (node-right n) n npos npos)]
[else (loop (node-right n) so-far so-far-pos npos)])))))
Copy link
Member

Choose a reason for hiding this comment

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

the formatting changes here don't seem like a win, alas.

(define b (send dc get-brush))
(send
dc
set-brush
Copy link
Member

Choose a reason for hiding this comment

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

another send formatting issue. I think this one has been mentioned before, tho.

@rfindler
Copy link
Member

Other than the comments above, I think this is good.

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