Details
-
Type:
Defect
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Completed
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
Description
This means that we cannot really emulate modes with constraints. The problem is related to -inc.
An easy way to try it out is to have a dummy fresh goal in predc and see the failing tests.
@@ -2932,7 +2932,7 @@
(invoke [this a]
(let [x (walk a x)]
(when (p x)
- ((remcg this) a))))
+ (bind* a (fresh [y] (== x x)) (remcg this)))))
IConstraintOp
(rator [_] (if (seq? pform)
`(predc ~pform)
Sorry I didn't mean to suggest this approach. In general you cannot put search related operators into a constraint. In fact I think we should replace any instances of bind* and bind in constraint logic as they really are a part of the search infrastructure and I'd like them to become implementation details of a particular search approach.
Instead I meant to suggest that the disjunction expressed by your example
(run 1 [re] (forall [s o] (conde [(== s '(foo bar bar bar)) (== o regex-BLANK)] [(!= s '(foo bar bar bar)) (== o regex-NULL)]) (regex-matcho re s o)))Is perhaps best described as an explicit constraint something more like:
(defn regexc [s o] (reify IFn (invoke [c a] (let [s (walk* a)[ (if (= s '(foo bar bar bar)) ((== o regex-BLANK) a) ((== o regex-NULL) a))))) ... IRunnable (runnable? [c a] (ground-terms? x)) ...))Of course someone might want to write constraint like this quite often, then I think it's question of what the best way to support that might be.
(run 1 [re] (forall [s o] (conde [(== s '(foo bar bar bar)) (== o regex-BLANK)] [(!= s '(foo bar bar bar)) (== o regex-NULL)]) (regex-matcho re s o)))(defn regexc [s o] (reify IFn (invoke [c a] (let [s (walk* a)[ (if (= s '(foo bar bar bar)) ((== o regex-BLANK) a) ((== o regex-NULL) a))))) ... IRunnable (runnable? [c a] (ground-terms? x)) ...))