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 #469

Closed
wants to merge 9 commits into from
Closed

Automated Resyntax fixes #469

wants to merge 9 commits into from

Conversation

resyntax-ci[bot]
Copy link
Contributor

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

Resyntax fixed 20 issues in 5 files.

  • Fixed 6 occurrences of provide/contract-to-contract-out
  • Fixed 3 occurrences of when-expression-in-for-loop-to-when-keyword
  • Fixed 3 occurrences of let-to-define
  • Fixed 3 occurrences of tidy-require
  • Fixed 1 occurrence of inline-unnecessary-define
  • Fixed 1 occurrence of inline-unnecessary-begin
  • Fixed 1 occurrence of always-throwing-if-to-when
  • Fixed 1 occurrence of map-to-for
  • Fixed 1 occurrence of arrow-contract-with-rest-to-arrow-contract-with-ellipses

resyntax-ci bot added 9 commits January 1, 2025 00:17
Keep imports in `require` sorted and grouped by phase, with collections before files.
The `provide/contract` form is a legacy form made obsolete by `contract-out`.
Internal definitions are recommended instead of `let` expressions, to reduce nesting.
…ellipses`

This `->*` contract can be rewritten using `->` with ellipses.
This `map` operation can be replaced with a `for/list` loop.
This variable is returned immediately and can be inlined.
Use the `#:when` keyword instead of `when` to reduce loop body indentation.
This `begin` form can be flattened into the surrounding definition context.
Using `when` and `unless` is simpler than a conditional with an always-throwing branch.
empty
(cons/c rc rc))))
rc)
(recursive-contract (or/c c empty (cons/c rc rc))))
Copy link
Contributor

Choose a reason for hiding this comment

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

Whoa!

Copy link
Contributor

Choose a reason for hiding this comment

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

@jackfirth this needs a side condition to make sure that rc doesn't occur in the body of define.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

If the inlined definition binds a (non-recursive) lambda expression, would the name be lost?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, but that doesn't happen because first those get rewritten into function definitions of the form (define (f) ...) (as opposed to (define f (lambda () ...))). Then, there's a check in the inlining rule to not inline function definitions, only variable definitions.

Copy link
Contributor

Choose a reason for hiding this comment

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

Wow, this is very cool!

@jackfirth jackfirth closed this Jan 5, 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.

3 participants