Introduction to Programming Assignment 1, 15 Aug, 2008 Due Mon 25 Aug, 2008 1. Define the function leastTwo :: Int > Int-> Int -> Int that returns the sum of the smallest two of its three inputs. For instance: leastTwo 3 1 2 = 3 leastTwo 3 4 3 = 6 leastTwo 8 8 3 = 11 2. Define the function largestDivisor :: Int -> Int that takes a positive integer n as input and returns the largest proper divisor of n --- that is, the largest divisor of n strictly smaller than n. For instance: largestDivisor 12 = 6 largestDivisor 27 = 9 largestDivisor 13 = 1 3. Define a function charsToNum :: [Char] -> Int that converts a list of characters representing numbers to its corresponding value as an integer. To do this, use an auxiliary function charToDigit :: Char -> Int that converts a digit like '8' to its value, 8. The value of non-digits should be taken to be 0. In other words, charToDigit maps '0','1',...,'9' to 0,1,...,9 respectively and maps all other characters are mapped to 0. Here are some typical results that charsToNum should report: charsToNum ['1','3','8'] should return 138 charsToNum ['1','a','b','9'] should return 1009 4. Define a function descending :: [Int] -> Bool that returns True if each element in its input list is at least as big as the one before it. For instance: descending [] = True descending [4,4,3] = True descending [19,17,18,7] = False 5. Define a function alternating :: [Int] -> Bool that returns True if the values in the input list alternately go up and down (in a strict manner). For instance: alternating [] = True alternating [1,3,2,3,1,5] = True alternating [3,2,3,1,5] = True alternating [3,2,2,1,5] = False alternating [3,2,1,3,5] = False ======================================================================