0.8.4-SNAPSHOT Arrow_down_16x16

extend-to-fd

clojure.core.logic.fd

  • (extend-to-fd t)

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/core/logic/fd.clj:181 top

(defmacro extend-to-fd [t]
  `(extend-type ~t
     IMemberCount
     (~'member-count [this#] 1)

     IInterval
     (~'lb [this#] this#)
     (~'ub [this#] this#)
     (~'bounds [this#] (pair this# this#))

     ISortedDomain
     (~'drop-one [this#]
       nil)
     (~'drop-before [this# n#]
       (when (clojure.core/>= this# n#)
         this#))
     (~'keep-before [this# n#]
       (when (clojure.core/< this# n#)
         this#))

     IFiniteDomain
     (~'domain? [this#] true)

     ISet
     (~'member? [this# that#]
       (if (integer? that#)
         (= this# that#)
         (member? that# this#)))
     (~'disjoint? [this# that#]
       (if (integer? that#)
         (not= this# that#)
         (disjoint? that# this#)))
     (~'intersection [this# that#]
       (cond
        (integer? that#) (when (= this# that#)
                           this#)
        (interval? that#) (intersection that# this#)
        :else (intersection* this# that#)))
     (~'difference [this# that#]
       (cond
        (integer? that#) (if (= this# that#)
                           nil
                           this#)
        (interval? that#) (difference that# this#)
        :else (difference* this# that#)))

     IIntervals
     (~'intervals [this#]
       (list this#))))
Vars in clojure.core.logic.fd/extend-to-fd:
Used in 0 other vars

Comments top

No comments for extend-to-fd. Log in to add a comment.