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


func sum_of_squares(vector) {
    var sum = 0;
    vector.each { |n| sum += n**2 };
    return sum;
}
 
say sum_of_squares([]);         # 0
say sum_of_squares([1,2,3]);    # 14