-
-
Notifications
You must be signed in to change notification settings - Fork 102
Automated Resyntax fixes #1448
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
base: master
Are you sure you want to change the base?
Automated Resyntax fixes #1448
Conversation
The `define-simple-macro` form has been renamed to `define-syntax-parse-rule`.
The `null?` predicate can be used to test for the empty list.
Internal definitions are recommended instead of `let` expressions, to reduce nesting.
Only one of the `for/fold` expression's result values is used. Use the `#:result` keyword to return just that result.
The `define` form supports a shorthand for defining functions.
This `map` operation can be replaced with a `for/list` loop.
Internal definitions are recommended instead of `let` expressions, to reduce nesting.
This negated `when` expression can be replaced by an `unless` expression.
This `if` expression can be refactored to an equivalent expression using `and`.
The `syntax-disarm` function is a legacy function that does nothing.
Using `cond` instead of `if` here makes `begin` unnecessary
The `let` expression in this `begin0` form can be extracted into the surrounding definition context.
This `case-lambda` form only has one case. Use a regular lambda instead.
Using `when` and `unless` is simpler than a conditional with an always-throwing branch.
This quasiquotation is equialent to a simple `list` call.
This `sort` expression can be replaced with a simpler, equivalent expression.
This expression is equivalent to calling the `positive?` predicate.
This `if` expression can be refactored to an equivalent expression using `and`.
Internal definitions are recommended instead of `let` expressions, to reduce nesting.
Internal definitions are recommended instead of `let` expressions, to reduce nesting.
This `if`-`else` chain can be converted to a `cond` expression.
This `let` expression can be pulled up into a `define` expression.
@@ -9,17 +9,16 @@ | |||
(let loop ([v stx]) | |||
(cond | |||
[(syntax? v) | |||
(let* ([stx (syntax-disarm v orig-insp)] | |||
(let* ([stx v] |
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.
couldn't this have been converted to define
?
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.
Yes. But Resyntax has a bug in it currently that prevents it from seeing that, see jackfirth/resyntax#345.
(if ((car p?*) x) | ||
(loop (cdr p?*)) | ||
#false))))) | ||
(define ((shallow-and/c . pred*) x) |
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.
These functions could both be converted to for
loops automatically (for/and and for/or respectively).
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.
Filed jackfirth/resyntax#454.
(locate-stx e)) | ||
e)))) | ||
(define l (current-logger)) | ||
(locate-stx e) |
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.
This change is unfortunate because of the commented-out code.
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.
Ah. The comment detector in Resyntax doesn't see expression comments because writing my own lexer for those was difficult, which is why Resyntax didn't preserve comments here. See jackfirth/resyntax#149. Eventually I'll get around to properly integrating Resyntax with module-lexer
/ module-lexer*
, which should fix this issue.
@jackfirth I made a few resyntax-related comments but basically this is fine. |
Resyntax fixed 42 issues in 20 files.
let-to-define
cond-let-to-cond-define
define-lambda-to-define
if-else-false-to-and
nested-if-to-cond
inverted-when
map-to-for
zero-comparison-to-positive?
define-simple-macro-to-define-syntax-parse-rule
sort-with-keyed-comparator-to-sort-by-key
begin0-let-to-define-begin0
case-lambda-with-single-case-to-lambda
quasiquote-to-list
for/fold-result-keyword
define-let-to-double-define
if-begin-to-cond
equal-null-list-to-null-predicate
always-throwing-if-to-when
syntax-disarm-migration