(Solved) : 6 5 Pts Complete Following Function Definition Stutter N X Return List Length N Element X Q43945028 . . .
Haskell Programming – Code
Do it in Haskell GHCI

![stutter n x= [ ???1 | ???? <- ???3] (Hints: What do we want for ???, ? We need a list for the ???3; what should its length be](https://media.cheggcdn.com/media/5b7/5b7578b6-d8dd-47cb-84b7-cc7e5ff55d16/phpiW1rw8.png)
6. [5 pts). Complete the following function definition: stutter n x should return a list of length n where each element is x. E.g., stutter 3 5 = [5,5,5]. Use a list comprehension to produce the result. Note stutter 0 x= [ ]. Don’t worry about n <0; the canonical solution makes stutter return [ ]. stutter n x= [ ???1 | ???? <- ???3] (Hints: What do we want for ???, ? We need a list for the ???3; what should its length be? Do the values of ???z matter?) [11 pts). Let g be the list defined below. > rot x = last x : init x > g = [1,3,5] : [rot x | X <- g] Use referential transparency to calculate/show the pattern of the values for take ng for n = 0, 1, 2, …. Don’t just show the results of the expressions: The point of the problem is to explain how the calculations work/are related. If you want, you can use a couple of properties: take (m+1) g = head g: take m(tail g) and take (m+1) g= take mg ++ [e] where e is the expression for the last element of take (m+1) g. Show transcribed image text 6. [5 pts). Complete the following function definition: stutter n x should return a list of length n where each element is x. E.g., stutter 3 5 = [5,5,5]. Use a list comprehension to produce the result. Note stutter 0 x= [ ]. Don’t worry about n g = [1,3,5] : [rot x | X
Expert Answer
Answer to 6. [5 pts). Complete the following function definition: stutter n x should return a list of length n where each element …
OR