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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started