Comp 372 Program 2 Feb 9, 2004 Peter Dordal Due: Monday, Feb 16 The following functions are to be defined in Haskell. If you use another implementation than Hugs, please let me know. Use the pattern form of function definitions where possible. These can all be defined by (primitive) recursion. Alternatively, you can often express these as a combination of 1. Define the function sumcubes :: Int -> Int sumcubes(n) should return the sum 1^3 + 2^3 + ... + n^3. 2. Define the function divisors :: Int -> [Int] which returns the list of positive divisors of a positive integer (and the empty list when the argument is <= 0). For example, divisors 12 --> [1,2,3,4,6,12] 3. Define the list function unique :: [a] -> [a] that returns the list with duplicates eliminated. For example, unique [1, 2, 1, 3, 2, 4] should return [1, 2, 3, 4]. (Returning [1, 3, 2, 4], where we keep the elements in order of their *last* occurrence, is also acceptable.) 4. Define the function countwhat, as in the first (lisp) assignment. This should take a list and a predicate, and return the count of the number of elements of the list that satisfy the predicate. For example, countwhat isEven [1, 2, 3, 4, 5, 7] should return 2 5. Define a function iterate n f x that applies the function f to x n times: f(f(...f(x))). For example, iterate 3 sqr 2 should return 256, the result of squaring 2 three times. You may need to call it "myiterate" or "iterate2" 6. *Using* the iterate function from number 5, define a function pow(x,n) = x^n. Iterate the function \y -> y*x applied n times to the value 1.