diff --git a/core/Double.carp b/core/Double.carp index 67041504..7da799e7 100644 --- a/core/Double.carp +++ b/core/Double.carp @@ -61,7 +61,15 @@ (defn add-ref [x y] (+ @x @y)) - - (defn cmp [x y] - (if (= (the Double @x) @y) 0 (if (< @x @y) -1 1))) +) + +(defmodule DoubleRef + (defn = [a b] + (Double.= @a @b)) + + (defn < [a b] + (Double.< @a @b)) + + (defn > [a b] + (Double.> @a @b)) ) diff --git a/core/Float.carp b/core/Float.carp index ef278879..23c6df36 100644 --- a/core/Float.carp +++ b/core/Float.carp @@ -61,7 +61,15 @@ (defn add-ref [x y] (+ @x @y)) - - (defn cmp [x y] - (if (= (the Float @x) @y) 0 (if (< @x @y) -1 1))) +) + +(defmodule FloatRef + (defn = [a b] + (Float.= @a @b)) + + (defn < [a b] + (Float.< @a @b)) + + (defn > [a b] + (Float.> @a @b)) ) diff --git a/core/Int.carp b/core/Int.carp index 89fede56..01b254ce 100644 --- a/core/Int.carp +++ b/core/Int.carp @@ -41,7 +41,15 @@ (defn add-ref [x y] (+ @x @y)) - - (defn cmp [x y] - (if (= (the Int @x) @y) 0 (if (< @x @y) -1 1))) +) + +(defmodule IntRef + (defn = [a b] + (Int.= @a @b)) + + (defn < [a b] + (Int.< @a @b)) + + (defn > [a b] + (Int.> @a @b)) ) diff --git a/core/Interfaces.carp b/core/Interfaces.carp index b8dc0053..33ab5fc2 100644 --- a/core/Interfaces.carp +++ b/core/Interfaces.carp @@ -26,7 +26,6 @@ (definterface random (Fn [] a)) (definterface random-between (Fn [a a] a)) -(definterface cmp (Fn [&a &a] Int)) (definterface pi a) @@ -41,3 +40,8 @@ (defn >= [a b] (or (> a b) (= a b))) + +(defn cmp [a b] + (if (= a b) + 0 + (if (< a b) -1 1))) diff --git a/core/Long.carp b/core/Long.carp index 5f16787e..ce71f29a 100644 --- a/core/Long.carp +++ b/core/Long.carp @@ -39,7 +39,15 @@ (defn even? [a] (= (mod a 2l) 0l)) (defn odd? [a] (not (even? a))) - - (defn cmp [x y] - (if (= (the Long @x) @y) 0 (if (< @x @y) -1 1))) +) + +(defmodule LongRef + (defn = [a b] + (Long.= @a @b)) + + (defn < [a b] + (Long.< @a @b)) + + (defn > [a b] + (Long.> @a @b)) )