Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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