Differo vs. fd / distinct in core.logic

What is the advantage of using fd/distinctin cases where the elements will be in the final area instead distincto?

Next come back ([0 1] [1 0]).

;;; With distincto
(run* [q]
  (fresh [x y]
    (fd/in x y (fd/interval 1))
      (distincto [x y])
      (== q [x y])))

;;; With fd/distinct
(run* [q]
  (fresh [x y]
    (fd/in x y (fd/interval 1))
      (fd/distinct [x y])
      (== q [x y])))

;;; Without fd at all. 
(let [interval [0 1]]
  (run* [q]
    (fresh [x y]
      (membero x interval)
      (membero y interval)
      (distincto [x y])
      (== q [x y]))))

It is noteworthy that although you can use distinctoanywhere you can use fd/distinct(but not vice versa), the same cannot be said for memberoand fd/in.

+5
source share
1 answer

fd/distinct , distincto, . fd/distinct , distincto !=.

+3

All Articles