Skip to content

Latest commit

 

History

History
27 lines (18 loc) · 974 Bytes

Chapter7.md

File metadata and controls

27 lines (18 loc) · 974 Bytes

Chapter 7 Exercises

Exercise 0

Define a function called zip that takes an argument of type (Vec A n) and a second argument of type (Vec B n) and evaluates to a vlue of type (Vec (Pair A B) n), the result of zipping the first and second arguments.

Answer

Exercise 1

Define a function called append that takes an argument of type (Vec E m) and an argument of type (Vect E n) and evaluates to a value of type (Vec (+ m n)), the result of appending the elements of the second argument to the end of the first.

Answer

Exercise 2

Define a function called drop-last-k that takes an argument of type (Vec E ?) and evaluates to a value of type (Vec E ?), the result of dropping the last k elements from the first argument. NB: The type of the function should guarantee that we can't drop more elements than there are in the first argument.

Answer