3. List Operations Please define the following functions in Haskell. Please write your own code rather than using the list functions pre-defined by Haskell. (a) Function zip1 takes two lists as input and zips them together to produce a list of pairs. If the two list are not of the same length, the resultant list is of the length of the shorter one. Example: zipi (1,2,3,4) (2,3,4] [(1,2), (2,3), (3,4)] (b) Function zip2 takes two lists as input and zip them together to produce a list of pairs. If the two list are not of the same length, the resultant list is of the length of the longer one, and duplicate the elements in the longer list when the shorter one runs out. Example: zip2 (1,2,3,6) [2,3,4] [(1,2), (2,3), (3,4),(6,6)] (c) Function find takes an element and a list as input, and returns the index of the first och currence of the element in the list (the index of the first element is 0), and return -1 if the element is not in the list. Examples: find 5 (1,3,5,6,2,5,7) = 2 find 5 [1,2,4,7] = -1 (a) Function reduceList:: (a -> a -> a) -> [a] -> a takes two inputs, the first one is a function that takes two inputs and generate an output, all of type a, the second one is a list whose elements are of type a, and reduces the list using the function. Examples: reduceList (-) (8,3,1) - (8-3) -1 - 4 () Function compose takes two relations, represented as a list of pairs, as input, and computes the composition of the two relations. Example: compose ((1,2),(1,3)] [(2,3), (2,4).(3,2).(3,3)] - [(1,3).(1,4),(1,2)] 3. List Operations Please define the following functions in Haskell. Please write your own code rather than using the list functions pre-defined by Haskell. (a) Function zip1 takes two lists as input and zips them together to produce a list of pairs. If the two list are not of the same length, the resultant list is of the length of the shorter one. Example: zipi (1,2,3,4) (2,3,4] [(1,2), (2,3), (3,4)] (b) Function zip2 takes two lists as input and zip them together to produce a list of pairs. If the two list are not of the same length, the resultant list is of the length of the longer one, and duplicate the elements in the longer list when the shorter one runs out. Example: zip2 (1,2,3,6) [2,3,4] [(1,2), (2,3), (3,4),(6,6)] (c) Function find takes an element and a list as input, and returns the index of the first och currence of the element in the list (the index of the first element is 0), and return -1 if the element is not in the list. Examples: find 5 (1,3,5,6,2,5,7) = 2 find 5 [1,2,4,7] = -1 (a) Function reduceList:: (a -> a -> a) -> [a] -> a takes two inputs, the first one is a function that takes two inputs and generate an output, all of type a, the second one is a list whose elements are of type a, and reduces the list using the function. Examples: reduceList (-) (8,3,1) - (8-3) -1 - 4 () Function compose takes two relations, represented as a list of pairs, as input, and computes the composition of the two relations. Example: compose ((1,2),(1,3)] [(2,3), (2,4).(3,2).(3,3)] - [(1,3).(1,4),(1,2)]