[LOGIC-126] fd/* and fd/+ interaction bug Created: 28/Mar/13 Updated: 28/Jul/13 Resolved: 28/Mar/13
|Reporter:||David Nolen||Assignee:||David Nolen|
Via this StackOverflow question http://stackoverflow.com/questions/15671823/unexpected-results-with-clojure-core-logic-using-clp-fd
Returns too many answers. Even if we desugar into:
We see results which clearly violate the fd/+ constraint.
|Comment by David Nolen [ 28/Mar/13 12:58 PM ]|
It seems like we should be able to fix this at the level of update-var-dom by checking that the var doesn't already have a value in the substitution, but oddly by doing this we run into some strange non-termination behavior. I've experienced this before when trying to flip the order of checks in let-dom, but at the time I was too busy with bigger problems to look at the issue more closely.
|Comment by David Nolen [ 28/Mar/13 1:01 PM ]|
After digging into this some it looks like we have a fairly nice opportunity to refactor and make things considerably faster. In the Scheme version get-dom / walk are necessarily separate operations because of the implementation. This is not necessary in core.logic because of SubstValue. get-dom should always do the right thing - return the value in the substitution if present or domain otherwise. The constraint writers need not bother with walk at all.
|Comment by David Nolen [ 28/Mar/13 1:27 PM ]|
To be clear get-dom has different contract than walk - get-dom will return a not found value instead of a logic var. It would be nice to be able to return nil but we could image CLP(Set) and other cases where the possible values includes nil.
|Comment by David Nolen [ 28/Mar/13 10:40 PM ]|