Calculate the sum of squares s of data, an array of floating point values.
s = data.sum{ _1**2 }
s = data.sum{|i| i**2}
(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 +)))
using System.Linq;
var s = data.Sum(x => x * x);
var s = data.map((v) => v * v).reduce((sum, v) => sum + v);
s = sum( data**2 )
import "math"
var s float64 for _, d := range data { s += math.Pow(d, 2) }
def s = data.sum { it ** 2 }
sumOfSquares = sum . map (^2)
s = data.reduce((a, c) => a + c ** 2, 0)
import java.util.Arrays;
double s = Arrays.stream(data).map(i -> i * i).sum();
import static java.util.stream.DoubleStream.of;
double s = of(data).map(x -> x * x).sum();
import static java.util.stream.DoubleStream.of; import java.math.BigDecimal;
BigDecimal s = of(data) .mapToObj(String::valueOf) .map(BigDecimal::new) .map(x -> x.multiply(x)) .reduce(BigDecimal::add) .get();
uses math;
var data: array of double; ... s := SumOfSquares(data); ...
use List::Util qw(sum);
my $s = sum map { $_ ** 2 } @data;
s = sum(i**2 for i in data)
f = lambda x: x * x s = sum(map(f, data))
let s = data.iter().map(|x| x.powi(2)).sum::<f32>();
No security, no password. Other people might choose the same nickname.