Skip to content
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 #1426

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Automated Resyntax fixes #1426

wants to merge 10 commits into from

Conversation

resyntax-ci[bot]
Copy link
Contributor

@resyntax-ci resyntax-ci bot commented Jan 10, 2025

Resyntax fixed 50 issues in 14 files.

  • Fixed 37 occurrences of single-clause-match-to-match-define
  • Fixed 3 occurrences of let-to-define
  • Fixed 2 occurrences of always-throwing-if-to-when
  • Fixed 2 occurrences of inline-unnecessary-define
  • Fixed 1 occurrence of if-let-to-cond
  • Fixed 1 occurrence of if-else-false-to-and
  • Fixed 1 occurrence of define-let-to-double-define
  • Fixed 1 occurrence of if-begin-to-cond
  • Fixed 1 occurrence of map-to-for
  • Fixed 1 occurrence of define-lambda-to-define

resyntax-ci bot added 10 commits January 10, 2025 00:24
This `match` expression can be simplified using `match-define`.
Internal definitions are recommended instead of `let` expressions, to reduce nesting.
Using `cond` instead of `if` here makes `begin` unnecessary
This `if` expression can be refactored to an equivalent expression using `and`.
This `map` operation can be replaced with a `for/list` loop.
The `define` form supports a shorthand for defining functions.
Using `when` and `unless` is simpler than a conditional with an always-throwing branch.
This variable is returned immediately and can be inlined.
This `let` expression can be pulled up into a `define` expression.
`cond` with internal definitions is preferred over `if` with `let`, to reduce nesting
(list p*-base
p*-name
(if (places)
(delay/thread (begin0 (run-in-other-place p* error?)
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be fixed in fmt

Copy link
Contributor

@sorawee sorawee Jan 10, 2025

Choose a reason for hiding this comment

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

Fixed in sorawee/fmt#84. @jackfirth, is it possible to re-run Resyntax?

(delay/thread (begin0 (run-in-other-place p* error?)
(when (zero? (modulo i 10))
(eprintf "."))))
(delay (parameterize ([read-accept-reader #t]
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto.

(if (s-exn? res)
(raise (deserialize-exn res))
res)]
(when (s-exn? res)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is amazing!

sorawee added a commit to sorawee/fmt that referenced this pull request Jan 10, 2025
sorawee added a commit to sorawee/fmt that referenced this pull request Jan 10, 2025
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.

1 participant