Task

Write a program to find the sum of squares of a numeric vector.

The program should work on a zero-length vector (with an answer of   0).



Related task

   Mean


import system'routines;
import extensions;
 
SumOfSquares(list)
    = list.selectBy:(x => x * x).summarize(new Integer());
 
public program()
{
    console 
        .printLine(SumOfSquares(new int[]{4, 8, 15, 16, 23, 42}))
        .printLine(SumOfSquares(new int[]{1, 2, 3, 4, 5}))
        .printLine(SumOfSquares(Array.MinValue))
}