Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

52 lines (46 sloc) 1.237 kb
(ns clojure.core.logic.arithmetic
(:refer-clojure :exclude [== = > < >= <=])
(:use [clojure.core.logic.protocols]
[clojure.core.logic]))
(defmacro =
"Goal for testing whether x and y are equal. Non-relational."
[x y]
`(fn [a#]
(let [wx# (walk a# ~x)
wy# (walk a# ~y)]
(if (clojure.core/= wx# wy# )
a# nil))))
(defmacro >
"Goal for testing whether x is greater than y. Non-relational."
[x y]
`(fn [a#]
(let [wx# (walk a# ~x)
wy# (walk a# ~y)]
(if (clojure.core/> wx# wy# )
a# nil))))
(defmacro >=
"Goal for testing whether x is greater than or equal to y.
Non-relational."
[x y]
`(fn [a#]
(let [wx# (walk a# ~x)
wy# (walk a# ~y)]
(if (clojure.core/>= wx# wy# )
a# nil))))
(defmacro <
"Goal for testing whether x is less than y. Non-relational."
[x y]
`(fn [a#]
(let [wx# (walk a# ~x)
wy# (walk a# ~y)]
(if (clojure.core/< wx# wy# )
a# nil))))
(defmacro <=
"Goal for testing whether x is less than or equal to y.
Non-relational."
[x y]
`(fn [a#]
(let [wx# (walk a# ~x)
wy# (walk a# ~y)]
(if (clojure.core/<= wx# wy#)
a# nil))))
Jump to Line
Something went wrong with that request. Please try again.