में विशिष्ट fd/distinct
का उपयोग करने का क्या फायदा है, जहां तत्व distincto
के बजाय एक सीमित डोमेन में होंगे?originalolog. fd/core.logic
निम्नलिखित सभी ([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]))))
विशेष रूप से, हालांकि ऐसा लगता है कि आप किसी भी जगह में distincto
उपयोग कर सकते हैं जहां fd/distinct
(लेकिन दूसरी तरह के आसपास) का उपयोग कर सकते हैं, एक ही membero
और fd/in
के लिए नहीं कहा जा सकता है।