Version: 5.2.1.6

#### 15/7: Functions on lists

Due: 5/7, midnight by email to dvanhorn.

Language: any.

You must complete this assignment individually and should not discuss solutions with anyone but the course staff.

##### 1.1Designing functions on lists of numbers

Design the following programs:

• sum - sums a list of numbers.

• sum-sqrs - sums the squares of a list of numbers.

• interleave - from two lists of equal length, produces a single list of interleaved elements. For example, if given 1, 2, 3 and 4, 5, 6, it produces 1, 4, 2, 5, 3, 6.

• closest-to-four - find the number closest to 4 in a given non-empty list of numbers.

• arg-zero - given a function on numbers and a non-empty list of numbers, produce an element of the list for which the function gives a result closest to 0 when applied to that element. In other words, if given function f and list x_0, x_1, ..., x_n, then arg-zero should produce x_i (for some i in 0..n) where f(x_i) is as close to zero as any f(x_j), for all j in 0..n.

You may use any programming language you’d like, but your programs must be well-designed according to the design recipe.

##### 1.2Submissions

This is the only assignment that will be submitted via email. Please send an email with the following form: