;; < and > accept numbers only and cannot be extended.
;; Ordering of your own values goes through compare - and compare
;; already knows vectors, so a "key vector" does all the work
(defrecord Point [x y])
(defn p-compare [a b]
(compare [(:x a) (:y a)] [(:x b) (:y b)]))
(def p1 (->Point 1 2))
(def p2 (->Point 2 3))
(println "b1 is" (pos? (p-compare p1 p2)))
;; b1 is false
(println "b2 is" (neg? (p-compare p1 p2)))
;; b2 is true
;; and the same rule sorts a whole collection
(def sorted (sort-by (juxt :x :y) [p2 p1 (->Point 0 9)]))
(println "sorted is" (mapv (juxt :x :y) sorted))