5
요소가 distincto
대신 유한 도메인에있는 경우 fd/distinct
을 사용하면 어떤 점이 유리합니까?core.logic에서 distincto 대 fd/distinct
다음은 모두 ([0 1] [1 0])
입니다. 당신이 (주변이 아닌 다른 방법) fd/distinct
를 사용할 수 있습니다 위치를 어떤 장소에 distincto
을 사용할 수 있습니다 보이지만
;;; 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]))))
특히, 동일 membero
및 fd/in
라고 할 수 없습니다.