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


get "libhdr"
 
let sumsquares(v, len) =
    len=0 -> 0,
    !v * !v + sumsquares(v+1, len-1)
 
let start() be
$(  let vector = table 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
    writef("%N*N", sumsquares(vector, 10))
$)