Be concise.
Be useful.
All contributions dictatorially edited by webmasters to match personal tastes.
Please do not paste any copyright violating material.
Please try to avoid dependencies to third-party libraries and frameworks.
(defn square [x] (* x x))
(def s (reduce + (map square data)))
(defn square [x] (* x x))
(def s (transduce (map square) + data))
(defn square [x] (* x x))
(def s (->> data (map square) (reduce +)))
var s = data.map((v) => v * v).reduce((sum, v) => sum + v);
s = sum( data**2 )
def s = data.sum { it ** 2 }
sumOfSquares = sum . map (^2)
s = data.reduce((a, c) => a + c ** 2, 0)
f = lambda x: x * x
s = sum(map(f, data))
s = sum(i**2 for i in data)
s = data.sum{|i| i**2}
s = data.sum{ _1**2 }
let s = data.iter().map(|x| x.powi(2)).sum::<f32>();