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


To run:
Start up.
Create a list.
Sum the squares of the list giving a ratio.
Destroy the list.
Write "Sum of squares: " then the ratio on the console.
Wait for the escape key.
Shut down.
 
An element is a thing with a ratio.
 
A list is some elements.
 
To add a ratio to a list:
Allocate memory for an element.
Put the ratio into the element's ratio.
Append the element to the list.
 
To create a list:
Add 3-1/10 to the list.
Add 1/1 to the list.
Add 4/1 to the list.
Add 1/1 to the list.
Add 5/1 to the list.
Add 9/1 to the list.
 
To sum the squares of a list giving a ratio:
Put 0 into the ratio.
Get an element from the list.
Loop.
If the element is nil, exit.
Add the element's ratio times the element's ratio to the ratio.
Put the element's next into the element.
Repeat.