I have a list, for example:
["Hello", "Goodbye"]
and I want to use map on the list;
I’ve successfully used map before:
f = ("example" ++)
so then:
map f ["Hello", "Goodbye"]
Would make the list:
["exampleHello", "exampleGoodbye"]
but how can I use the list items in the function f?
For example, if I wanted to repeat the list element, so
["Hello", "Goodbye"]
would become
["HelloHello", "GoodbyeGoodbye"]
How can I do that with map and a function f (and ++)?
Doing
results in
So
fcould be defined asf x = (x++x).