Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 Programming
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started