Function in Clojure that takes a list of n letters and returns a list

Viewed 74

I need your help to write a function that takes a list of letters like ['a', 'b', 'c'] and returns another list of letters like ['a', 'b', 'b', 'c', 'c', 'c'], this is the first element is repeated only once the second element is repeated two times, the third element is repeated three times, etc. Thank you in advance!.

1 Answers
(mapcat repeat (map inc (range)) ["a" "b" "c"])
Related