1

I understand that project in core.logic is not relational.

However, it seems that I can get relational-like behaviour by projecting in both directions inside conda, e.g.:

(defn lifto-with-inverse
  "Lifts a unary function and its inverse into a core.logic relation."
  ([f g]
    (fn [& vs]
      (let [[x y] vs]
        (conda 
          [(pred x number?) (project [x] (== y (f x)))]
          [(pred y number?) (project [y] (== x (g y)))])))))

(let [inco (lifto-with-inverse inc dec)]
   (run* [q] (inco q 3)))
=> 2

Does this count as a relational operation? Or is there something else missing that makes this non-relational?

dnolen
  • 18,496
  • 4
  • 62
  • 71
mikera
  • 105,238
  • 25
  • 256
  • 415

1 Answers1

3

It still seems like in this case one of the arguments must be ground making it non-relational.

dnolen
  • 18,496
  • 4
  • 62
  • 71