这是indexloc提供的服务,不要输入任何密码
Skip to content

Automated Resyntax fixes #1441

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

Merged
merged 20 commits into from
Apr 4, 2025
Merged

Automated Resyntax fixes #1441

merged 20 commits into from
Apr 4, 2025

Conversation

resyntax-ci[bot]
Copy link
Contributor

@resyntax-ci resyntax-ci bot commented Mar 7, 2025

Resyntax fixed 50 issues in 17 files.

  • Fixed 10 occurrences of let-to-define
  • Fixed 8 occurrences of single-clause-match-to-match-define
  • Fixed 5 occurrences of define-lambda-to-define
  • Fixed 4 occurrences of if-begin-to-cond
  • Fixed 3 occurrences of zero-comparison-to-positive?
  • Fixed 3 occurrences of if-let-to-cond
  • Fixed 3 occurrences of define-values-values-to-define
  • Fixed 2 occurrences of inline-unnecessary-define
  • Fixed 1 occurrence of always-throwing-cond-to-when
  • Fixed 1 occurrence of for/fold-with-conditional-body-to-unless-keyword
  • Fixed 1 occurrence of zero-comparison-lambda-to-positive?
  • Fixed 1 occurrence of inverted-unless
  • Fixed 1 occurrence of when-expression-in-for-loop-to-when-keyword
  • Fixed 1 occurrence of define-let-to-double-define
  • Fixed 1 occurrence of define-begin0-extraction
  • Fixed 1 occurrence of inverted-when
  • Fixed 1 occurrence of map-to-for
  • Fixed 1 occurrence of unless-expression-in-for-loop-to-unless-keyword
  • Fixed 1 occurrence of and-match-to-match
  • Fixed 1 occurrence of inline-unnecessary-begin

resyntax-ci bot added 20 commits March 7, 2025 00:40
Internal definitions are recommended instead of `let` expressions, to reduce nesting.
This `match` expression can be simplified using `match-define`.
The `begin0` in this definition can be extracted into the surrounding definition context.
This `and` expression can be turned into a clause of the inner `match` expression, reducing nesting.
This expression is equivalent to calling the `positive?` predicate.
This use of `define-values` is unnecessary.
Use the `#:unless` keyword instead of `unless` to reduce loop body indentation.
Use the `#:when` keyword instead of `when` to reduce loop body indentation.
Using `cond` instead of `if` here makes `begin` unnecessary
`cond` with internal definitions is preferred over `if` with `let`, to reduce nesting
This `let` expression can be pulled up into a `define` expression.
Using `when` and `unless` is simpler than a conditional with an always-throwing branch.
This lambda function is equivalent to the built-in `positive?` predicate.
This `map` operation can be replaced with a `for/list` loop.
The `define` form supports a shorthand for defining functions.
This variable is returned immediately and can be inlined.
This `for/fold` loop can be simplified by using the `#:unless` keyword.
This `begin` form can be flattened into the surrounding definition context.
This negated `when` expression can be replaced by an `unless` expression.
This negated `unless` expression can be replaced by a `when` expression.
@samth samth merged commit 7921b8d into master Apr 4, 2025
5 checks passed
@samth samth deleted the autofix-27-1 branch April 4, 2025 14:38
@@ -83,9 +83,8 @@
;; Takes a possible substitution and computes
;; the substituted range type if it is not #f
(define (finish substitution)
(begin0
Copy link
Contributor

Choose a reason for hiding this comment

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

@samth This change was buggy. The define-begin0-extraction rule didn't account for when the surrounding define is a function definition instead of a variable definition.

Copy link
Contributor

Choose a reason for hiding this comment

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

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.

2 participants