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

Optimize subsetting #220

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Optimize subsetting #220

wants to merge 8 commits into from

Conversation

PMassicotte
Copy link
Collaborator

This is a complete rework of this functionality. It avoids using recursive function, which simplify the logic. It is also faster.

…set expressions

fix(brackets.lua): ensure only first level of subsetting for $ operator is processed
refactor(brackets.lua): simplify replacement logic in formatsubsetting function
…gs for clarity

refactor(brackets.lua): separate processing of extract_operator and subset nodes into distinct passes for better maintainability and readability
style(brackets.lua): remove redundant comment about empty table
style(brackets.lua): simplify comments on applying replacements in reverse order
refactor(brackets.lua): streamline build_extract_operator_replacement function
fix(brackets.lua): ensure correct replacement of extract_operator nodes
perf(brackets.lua): optimize replacement application order
@PMassicotte PMassicotte marked this pull request as ready for review August 28, 2024 11:40
@jalvesaq
Copy link
Member

It's falling in this case:

aa$bb$$cc

@jalvesaq
Copy link
Member

This also doesn't seem to be 100% correct:

aa <- list(bb=c("w" = 1, "x" = 2, "y"= 3, "z" = 4))
aa$bb[3]

because the output of aa$bb[3] is different from the output of aa[["bb"]][[3]].

@PMassicotte
Copy link
Collaborator Author

Good catch. Will work on that.

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.

2 participants