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

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

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!