clojure Clojure destructuring Destructuring and giving a name to the original argument value


(defn print-some-items 
   [[a b :as xs]]
  (println a)
  (println b)
  (println xs))

(print-some-items [2 3])

This example prints the output

[2 3]

The argument is destructured and the items 2 and 3 are assigned to the symbols a and b. The original argument, the entire vector [2 3], is also assigned to the symbol xs.