Menu

(Solved) : 4 4 Pts Rewrite Following Expression Uses Infix Notation Possible 1 21 Hint Name F G X Q43963120 . . .

Haskell Language – Code

Do it in Haskell GHCI

4. [4 pts). Rewrite the following expression so that it uses infix notation where possible [1/21]. (Hint: `name`.) f (g x (h6. [5 pts). Complete the following function definition: stutter n x should return a list of length n where each element is x.

4. [4 pts). Rewrite the following expression so that it uses infix notation where possible [1/21]. (Hint: `name`.) f (g x (h a b)) (c (d e f)). 5. [5 pts Complete the following function definition so that on any list that can be tested for == [1/21], f returns True. f x = x == [X !! i ???] 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= [ ???, ???? <- ???3] (Hints: What do we want for ???, ? We need a list for the ???3; what should its length be? Do the values of ???3 matter?) Show transcribed image text 4. [4 pts). Rewrite the following expression so that it uses infix notation where possible [1/21]. (Hint: `name`.) f (g x (h a b)) (c (d e f)). 5. [5 pts Complete the following function definition so that on any list that can be tested for == [1/21], f returns True. f x = x == [X !! i ???]
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

Expert Answer


Answer to 4. [4 pts). Rewrite the following expression so that it uses infix notation where possible [1/21]. (Hint: `name`.) f (g …

OR