Question: Write a polymorphic, recursive function stutterN that takes a number n and a list, and produces a list identical to the original, but each item

Write a polymorphic, recursive function stutterN that takes a number n and a list, and produces a list identical to the original, but each item is repeated n times. The type signature should be: stutterN : : Int [a] [a] For example: *Main> stutterN 3 "hello" "hhheeell1111000" *Main> stutterN 0 "hello" " " *Main> stutterN 4 [9] [9,9,9,9] Hint: you may want to write a helper function repeatN :: Int a [a] that repeats a given item n times
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
