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

refactor finding consistent value #252

Merged
merged 5 commits into from
Oct 14, 2022
Merged

refactor finding consistent value #252

merged 5 commits into from
Oct 14, 2022

Conversation

piever
Copy link
Collaborator

@piever piever commented Oct 14, 2022

No description provided.

@piever piever merged commit 4056c71 into master Oct 14, 2022
@piever piever deleted the pv/utils branch October 14, 2022 15:03
function findconsistentvalue(f::F, (col, cols...)::Tup) where F
val = f(col)
isconsistent = mapfoldl(isequal(val)∘f, &, cols; init=true)
return ifelse(isconsistent, val, nothing)
Copy link
Contributor

Choose a reason for hiding this comment

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

val might be nothing? I think we can follow Base._all_match_first style here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

val might be nothing?

Not really, we only use this to compute ranges of indices. If we happen to need that use case, we can always return Some(val), but I'd rather avoid the extra wrapping / unwrapping unless it's needed.

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