How to repeat string and take parts of it in Haskell

Viewed 202

I need to write a Haskell program that takes an integer and a list and repeats the characters of the list up to n digits:

Int -> [a] -> [a]

e.g. 3 "pink" would give "pin"
6 "blue" would give "bluebl"

I'm new to the Haskell so cannot form the logic or don't know if there's any function to do it.

1 Answers
Related