-
-
Notifications
You must be signed in to change notification settings - Fork 95
Automated Resyntax fixes #772
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?
Conversation
Nested `when` expressions can be merged into a single compound `when` expression.
Using `cond` allows converting `let` to internal definitions, reducing nesting
This `map` operation can be replaced with a `for/list` loop.
This `andmap` operation can be replaced with a `for/and` loop.
This `string-append` with `format` expression can be simplified to a single `format` call.
This `for-each` operation can be replaced with a `for` loop.
Internal definitions are recommended instead of `let` expressions, to reduce nesting.
The `define` form supports a shorthand for defining functions.
Functions returning lambdas can be written using curried function syntax.
This quasiquotation is equialent to a simple `list` call.
(send (get-frame) hide-error-report)))) | ||
(when (and old-error-report-visible? (is-current-tab?)) | ||
(send (get-frame) hide-error-report))) | ||
|
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 merged one of these before, but I'm not convinced of this one. The indentation savings in this example isn't serious but the and
makes it a bit harder to read, especially since it is all on one line.
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.
Interesting. I find this kind of thing more readable because it's easier to check that the code following it is outside the when
. But maybe there's some room for nuance about when the rule is worth applying. I'll give it some thought. Let me know if you see other instances of this rule that seem off to you.
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.
In this particular instance it is not helping that the two arguments to the "and" are on the same line. I think I would not see much difference between the two if the revised version had also taken 3 lines.
Resyntax fixed 20 issues in 3 files.
let-to-define
string-append-with-format-to-format
for-each-to-for
and-let-to-cond
andmap-to-for/and
quasiquote-to-list
define-lambda-to-define
nested-when-to-compound-when
define-lambda-to-curried-define
map-to-for