Skip to content

Commit

Permalink
Make Core/compare act more like Clojure's compare.
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Olson committed Apr 22, 2013
1 parent 9ac3b23 commit 90696b1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion kernel/core.apr
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -588,7 +588,14 @@
(defn compare (defn compare
"Return a negative number, zero, or a positive number when x is logically "Return a negative number, zero, or a positive number when x is logically
'less than', 'equal to', or 'greater than' y, respectively." 'less than', 'equal to', or 'greater than' y, respectively."
[x y] (. x <=> y)) [x y]
(if (nil? x)
(if (nil? y)
0
-1)
(if (nil? y)
1
(. x <=> y))))


(defn > (defn >
"Return true if nums are in monotonically decreasing order, otherwise false." "Return true if nums are in monotonically decreasing order, otherwise false."
Expand Down

0 comments on commit 90696b1

Please sign in to comment.