Question: /* QUESTION 1: Average of squares */ /* First, implement a function that returns the size of a list using fold_left. */ const ls_size =
/* QUESTION 1: Average of squares */
/*
First, implement a function that returns the size of a list using fold_left.
*/
const ls_size = ls => /**
assert(ls_size(ls) == 5);
/*
Second, implement a function that computes the sum-of-squares of a list of
integers using fold_left.
Example: sum_sqrs([2,3]) => 2*2 + 3*3 = 13.
*/
const sum_sqrs = ls => /**
assert(sum_sqrs(ls) == 55);
/*
Finally, use both functions to implement the average of squares function.
*/
const avg_sqrs = ls => /**
assert(avg_sqrs(ls) == 11);
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
