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 => /** **/ undefined; /** **/

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 => /** **/ undefined; /** **/

assert(sum_sqrs(ls) == 55);

/*

Finally, use both functions to implement the average of squares function.

*/

const avg_sqrs = ls => /** **/ undefined; /** **/

assert(avg_sqrs(ls) == 11);

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!