-
-
Notifications
You must be signed in to change notification settings - Fork 103
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 #1443
Automated Resyntax fixes #1443
Conversation
This `match` expression can be simplified using `match-define`.
The `define` form supports a shorthand for defining functions.
Internal definitions are recommended instead of `let` expressions, to reduce nesting.
This `define-syntax` macro can be replaced with a simpler, equivalent `define-syntax-rule` macro.
This `if` expression can be refactored to an equivalent expression using `and`.
This negated `when` expression can be replaced by an `unless` expression.
This expression is equivalent to calling the `positive?` predicate.
The `define-simple-macro` form has been renamed to `define-syntax-parse-rule`.
Providing the same identifier multiple times is unnecessary.
`cond` with internal definitions is preferred over `if` with `let`, to reduce nesting
The `apply` function accepts single arguments in addition to a trailing list argument.
This use of `define-values` is unnecessary.
This `sort` expression can be replaced with a simpler, equivalent expression.
This `map` operation can be replaced with a `for/list` loop.
This quasiquotation is equialent to a simple `list` call.
Only one of the `for/fold` expression's result values is used. Use the `#:result` keyword to return just that result.
Use the `#:when` keyword instead of `when` to reduce loop body indentation.
(tc-error (~a "structure type constructor applied to non-regular arguments" | ||
"\n type: " rator | ||
"\n arguments...: " rands))) | ||
"\n type: " | ||
rator | ||
"\n arguments...: " | ||
rands))) |
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.
@sorawee A nice fmt
improvement would be to keep description-value pairs adjacent in ~a
and similar formatting expressions.
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.
What exactly are considered "description-value pairs"?
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.
Some examples:
- The
field v ... ...
argument ofraise-arguments-error
. - Alternating pairs of strings and expressions in the arguments to
~a
,~v
,~s
, etc.
That is, cases that construct the <field>: <detail>
parts of an error message as described in Error Message Conventions. Not sure how easy it is to detect all of these though.
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.
I agree that it's a good idea for the raise-arguments-error
family and the hash
family. I don't yet buy that the heuristic described for ~a
will work well.
Resyntax fixed 50 issues in 18 files.
single-clause-match-to-match-define
let-to-define
define-syntax-syntax-rules-to-define-syntax-rule
if-else-false-to-and
quasiquote-to-list
sort-with-keyed-comparator-to-sort-by-key
zero-comparison-to-positive?
define-values-values-to-define
define-simple-macro-to-define-syntax-parse-rule
if-let-to-cond
provide-deduplication
when-expression-in-for-loop-to-when-keyword
for/fold-result-keyword
inverted-when
map-to-for
apply-flattening
define-lambda-to-define