Write a function that takes the yearly cost of energy plans from several providers
The function should return the average of cost of those energy plans.
()
(defn average-plan-cost [energy-plan-costs]
(/ (reduce + energy-plan-costs) (count energy-plan-costs)))
(average-plan-cost [10 12])
;; => 11
(average-plan-cost [250 190 270 180 220 240 200 210 220 230])
;; => 221
The functions
reduce
andcount
should help you solve this challengeUsing a vector of numbers to represent the energy plan costs is probably the simplest approach