(defn get-point [] [5 5])
;; core Clojure has no pattern matching over tuples: destructuring pulls
;; the parts out, and cond asks the questions about them
(let [[x y :as point] (get-point)]
(println "point" point "is"
(cond
(= point [0 0]) "(0, 0) point"
(= y 1) (str "(" x ", 1) point")
(= x 1) (str "(1, " y ") point")
(= x y) (str "(" x ", " y ") point")
:else "other point")))
;; case does compare whole vectors, but only against literal constants —
;; it cannot bind x or y out of them
(println "origin:" (case [0 0]
[0 0] "(0, 0) point"
"other point"))