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


define sum_squares(v);
    lvars s = 0, j;
    for j from 1 to length(v) do
        s + v(j)*v(j) -> s;
    endfor;
    s;
enddefine;
 
sum_squares({1 2 3 4 5}) =>