core.logic

custom defc constraint does not run

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

I have a custom constrain defined using defc, it looks like

(defc string-containsc [x y]
  (and (string? x)
       (.contains x y)))

I have a little core.logic program

(defn t []
  (logic/run* [q]
    (c/string-containsc q "foo")
    (logic/== q 1)))

the result of calling t is (1)

if I change the order of the goals:

(defn t []
  (logic/run* [q]
    (logic/== q 1)
    (c/string-containsc q "foo")))

the result of (t) is ()

Activity

Hide
David Nolen added a comment -

fixed

Show
David Nolen added a comment - fixed
Hide
Kevin Downey added a comment -

yep, thanks

Show
Kevin Downey added a comment - yep, thanks
Hide
David Nolen added a comment -
Show
David Nolen added a comment - Possible fix in master, http://github.com/clojure/core.logic/commit/c0a5ea982624c9e9af869be0b653bf83f60de062 Does this work for you?

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: