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

229 delayed_choices as separate funcitons #232

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

Conversation

chlebowa
Copy link
Contributor

Closes #229
Alternative to #231

CHANGES

Added first_choice and last_choice to extend all_choices functionality to subsets of available choices.

IMPLEMENTATION

all_choices, first_choice, and last_choice are functions of class delayed_choices. delayed_choices functions will add the appropriate subsetting operation to the $subset element of their delayed_data argument. Atomic arguments are returned as is.

if (inherits(selected) "delayed_choices") {
  selected <- selected(choices)              # modify delayed choices
} else {
  selected <- choices                        # use choices as is
}

all_choices is still a special case when checking arguments in some functions (choices vs multiple) so an extra class is added to the all_choices function to keep track of that.

@chlebowa chlebowa changed the title 229 delayed choices separate@main 229 delayed choices as separate funcitons Dec 19, 2024
@chlebowa chlebowa changed the title 229 delayed choices as separate funcitons 229 delayed_choices as separate funcitons Dec 19, 2024
@llrs-roche
Copy link

I like this approach more as all_choices is already released and this approach would keep it around.

About the exact implementation and other details I haven't reviewed it, but at first glance I'd like the explore the call to Reduce on R/delayed_choices.R lines 80 and 59. Maybe it can be reviewed & merged on the early January. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request]: add first_choice function
2 participants