(let [total (fn total [items discount] (reduce :+ 0.0 (map (fn [{quantity quantity unitPrice unitPrice}] (* (float (* quantity unitPrice)) (- 1.0 discount))) items)))] [(total [{quantity 3 unitPrice 20} {quantity 2 unitPrice 15}] 0.1) (total [{quantity 2 unitPrice 15}] 0.0) (total [] 0.5)])