So I've got this list of lists of strings:
What I want to do is transform each inner list into a single string like this:
Resulting in a list of strings.
I've tried various combinations of map, foldr, and anonymous functions, but I can't for the life of me figure out how to achieve my desired result.
Best How To :
There is a function
concat : string list -> string in the
String structure in the Basis Library, which happens to be at the top level. Therefore, you can define your function:
val concatEach = map concat
It is going to have type
string list list -> string list, which I guess is what you are looking for.
If you want to define your own
concat function, you can do it this way:
val myConcat = foldr (op ^) ""
Or, without using the
val myConcat' = foldr (fn (x, y) => x ^ y) ""