On 26 Feb 2010, at 02:21, Glen Rubin wrote:
Here is the code I wrote, sqrs.clj:(use '[clojure.contrib.generic.math-functions :only (sqr)]) (defn square-of-sum [coll] "adds up collection of numbers and then squares it" (sqr (reduce + coll)))
A different point: if you can sum your numbers using plain +, using generic/sqr is a waste, as it calls multimethod clojure.contrib.generic.arithmetic/* to do a multiplication. Just use #(* % %) instead.
Konrad. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en
