core.logic question

62 views
Skip to first unread message

ru

unread,
Sep 11, 2021, 1:15:50 PMSep 11
to Clojure
Dear clojure users and team!
I have a simple core.logic program:

(require '[clojure.core.logic :as l]
         '[clojure.core.logic.pldb :as db])
         
(db/db-rel In-zone t z)

(def bd (db/db-fact bd In-zone 'A 'B))

(println
  (db/with-db bd
        (l/run* [q]
          (l/fresh [x y]
            (In-zone x y)
            (== q 'IN-ZONE)))))

Why I get this error message? 

user=> (load-file "../programs/corelogic/search2.clj")
CompilerException java.lang.ClassCastException: class clojure.core.logic.LVar cannot be cast to class java.lang.Number (clojure.core.logic.LVar is in unnamed module of loader clojure.lang.DynamicClassLoader @233ae292; java.lang.Number is in module java.base of loader 'bootstrap'), compiling:(/home/ru/clojure/core.logic/../programs/corelogic/search2.clj:8:1) 

No any mention about numbers!

Thanks in advance for the help.
Sincerely,
  Ru

ru

unread,
Sep 30, 2021, 2:49:52 AMSep 30
to Clojure
Thanks to Tom: Mistake in "(== q 'IN-ZONE)". Must be "(l/== q 'IN-ZONE)"

By the way. Can anybody recommend comprehensive documentation on core.logic and its API, with examples and so on? All I have found is sketchy and fragmentary..

суббота, 11 сентября 2021 г. в 20:15:50 UTC+3, ru:
Reply all
Reply to author
Forward
0 new messages