-
-
Notifications
You must be signed in to change notification settings - Fork 103
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
Automated Resyntax fixes #1441
Conversation
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.
@@ -83,9 +83,8 @@ | |||
;; Takes a possible substitution and computes | |||
;; the substituted range type if it is not #f | |||
(define (finish substitution) | |||
(begin0 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in jackfirth/resyntax#445.
Resyntax fixed 50 issues in 17 files.
let-to-define
single-clause-match-to-match-define
define-lambda-to-define
if-begin-to-cond
zero-comparison-to-positive?
if-let-to-cond
define-values-values-to-define
inline-unnecessary-define
always-throwing-cond-to-when
for/fold-with-conditional-body-to-unless-keyword
zero-comparison-lambda-to-positive?
inverted-unless
when-expression-in-for-loop-to-when-keyword
define-let-to-double-define
define-begin0-extraction
inverted-when
map-to-for
unless-expression-in-for-loop-to-unless-keyword
and-match-to-match
inline-unnecessary-begin