Question: Haskell Programming 3. (18 points total) The function twice list should return true iff some value occurs twice in the list. E.g., > filter twice

Haskell ProgrammingHaskell Programming 3. (18 points total) The function twice list should return

3. (18 points total) The function twice list should return true iff some value occurs twice in the list. E.g., > filter twice [[],[1],[1,2], [2,2],[1,2,3],[1,2,1],[1,1,2], [1,2,2]] [[2,2],[1,2,1],[1,1,2],[1,2,2]] (2 points) What is the type of twice? (Include the typeclass.) a. (4 points) Briefly describe the syntactic and semantic bugs in the program below. (For syntactic errors, don't just parrot the Haskell error messages; give a brief human-understandable description.) :{ twice [] = False twice [_] = False twice [x,x] = True twice ( _ ++ [x] ++ - ++ [y] ++ _ ) = x == y twice (h1 : h2 : t) == (h1 == h2 || twice hi t) 3. (18 points total) The function twice list should return true iff some value occurs twice in the list. E.g., > filter twice [[],[1],[1,2], [2,2],[1,2,3],[1,2,1],[1,1,2], [1,2,2]] [[2,2],[1,2,1],[1,1,2],[1,2,2]] (2 points) What is the type of twice? (Include the typeclass.) a. (4 points) Briefly describe the syntactic and semantic bugs in the program below. (For syntactic errors, don't just parrot the Haskell error messages; give a brief human-understandable description.) :{ twice [] = False twice [_] = False twice [x,x] = True twice ( _ ++ [x] ++ - ++ [y] ++ _ ) = x == y twice (h1 : h2 : t) == (h1 == h2 || twice hi t)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!