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


SUMSQUARE(X)
 ;X is assumed to be a list of numbers separated by "^"
 NEW RESULT,I
 SET RESULT=0,I=1
 FOR  QUIT:(I>$LENGTH(X,"^"))  SET RESULT=($PIECE(X,"^",I)*$PIECE(X,"^",I))+RESULT,I=I+1
 QUIT RESULT