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

Var methods and ExtendFormula to make it easier to construct formulas #55

Merged
merged 3 commits into from
May 18, 2019

Conversation

jix
Copy link
Owner

@jix jix commented May 18, 2019

This resolves #18

jix added 3 commits May 17, 2019 13:41
This allows requesting new variables and, in the future, will allow code
that is generic over CnfFormula and Solver.
@jix
Copy link
Owner Author

jix commented May 18, 2019

bors r+

bors bot added a commit that referenced this pull request May 18, 2019
55: Var methods and ExtendFormula to make it easier to construct formulas r=jix a=jix

This resolves #18

Co-authored-by: Jannis Harder <[email protected]>
@bors bors bot merged commit b92d6e8 into master May 18, 2019
@bors bors bot deleted the cnf-ergonomics branch May 18, 2019 07:11
pub trait ExtendFormula: Sized {
/// Appends a clause to the formula.
///
/// `literals` can be an `IntoIterator<Item = Lit>` or `IntoIterator<Item = &Lit>`.
Copy link

Choose a reason for hiding this comment

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

The comment seam wrong here. This does not take a IntoIterator it takes a &[Lit]. Also If this replaces the removed add_clause above, then that is a semver breaking change.

let a = HashSet<Lit> ={...};
let mut b = CnfFormula::new();
b.add_clause(a.iter());

Works before and does not compile now.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Ah I missed updating the documentation here, thanks for spotting that. It's not semver breaking as I'm still on 0.x.y. Maybe I should add a more explicit warning that the API isn't stable yet. I will release a version 1.0 when I'm done tweaking the API.

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.

Improve CNF generation ergonomics
2 participants