Permalink
Browse files

Make Core/compare act more like Clojure's compare.

  • Loading branch information...
1 parent 9ac3b23 commit 90696b19ce8f71fca1049b516040abed6ffb5ca9 @solson solson committed Apr 22, 2013
Showing with 8 additions and 1 deletion.
  1. +8 −1 kernel/core.apr
View
9 kernel/core.apr
@@ -588,7 +588,14 @@
(defn compare
"Return a negative number, zero, or a positive number when x is logically
'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 >
"Return true if nums are in monotonically decreasing order, otherwise false."

0 comments on commit 90696b1

Please sign in to comment.