STAT 102 Midterm: STAT 102 UPenn Midterm1Fall 2001. Solutions

27 views9 pages
31 Jan 2019
School
Department
Course
Professor

Document Summary

February 21, 2014: program design (16 points) Use the four-step design methodology to implement a function called trim that, when given an integer n and a list x, returns the list with all occurrences of n removed from the beginning of the list. For example, trim 1 [1;1;2;1] should yield the list [2;1]: step 1 is understanding the problem. You don"t have to write anything for this part your answers below will demonstrate whether or not you succeeded with step 1: step 2 is formalizing the interface. Write down the type of the trim function as you might. Nd it in a . mli le or module interface. val trim: int -> int list -> int list. Accepting both int and "a type: step 3 is writing test cases. Complete the following tests with the expected behavior. We have done the rst one for you, based on the problem description.