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

Add a space in complex anonymous functions #236

Merged
merged 5 commits into from
Feb 20, 2025
Merged

Conversation

DavisVaughan
Copy link
Collaborator

Closes #235

Copy link
Collaborator

@lionel- lionel- left a comment

Choose a reason for hiding this comment

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

Do we have tests for chained unary formulas?

It should look like:

~~foo
~~ 1 + 2

Comment on lines 48 to 50
// "Complex" is anything except identifiers
!matches!(argument, AnyRExpression::RIdentifier(_))
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would expect ~NA and ~NULL to be treated like ~foo?
And probably other literals like ~10 too?

Copy link
Collaborator Author

@DavisVaughan DavisVaughan Feb 20, 2025

Choose a reason for hiding this comment

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

I don't think so, I believe that this behavior is only for identifiers. And is somewhat special to supporting tribble calls

tribble(
  ~x, ~y,
  ...
)

If not for tribble I would have been happy with unconditionally using a space between the ~ and the rhs, so to me the ~foo behavior is just a surgical patch to help that, and everything else gets a space

@DavisVaughan DavisVaughan merged commit 207f569 into main Feb 20, 2025
4 checks passed
@DavisVaughan DavisVaughan deleted the feature/unary-formula branch February 20, 2025 18:45
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.

Single sided ~ formulas with non-identifier RHS should add a space
2 participants