Sum of squares: Difference between revisions
→{{header|Picat}}
(→{{header|Tailspin}}: Deal with the zero-length special case) |
|||
Line 2,182:
</lang>
Usage for both examples: <code>sum_squares(array(1,2,3,4,5)); // 55</code>
=={{header|Picat}}==
<lang Picat>go =>
List = 1..666,
println(sum_squares(List)),
println(sum_squares([])),
nl.
sum_squares([]) = 0.
sum_squares(List) = sum([I*I : I in List]).</lang>
{{out}}
<pre>98691321
0</pre>
=={{header|PicoLisp}}==
|