;; "& values" collects the rest of the arguments into a sequence
(defn get-avg [& values]
(if (empty? values)
0
(/ (reduce + 0.0 values) (count values))))
(def avg (get-avg 1 2 3 4))
;; avg is 2.5
(println "avg is" avg)
;; a ready-made collection is spread into arguments by apply
(def nums [10 20 30])
(println "avg of a vector is" (apply get-avg nums))
(println "avg of nothing is" (get-avg))