1

How do I combine two lists of strings into one list of strings?

For example, this:

["aaaaaa", "aaaaaa","aaaaaa"] 
["bbbb", "bbbb", "  bb"]

would go into this:

["aaaaaabbbb","aaaaaabbbb", "aaaaaa  bb"]
2
  • what did you try? do you know hoogle? HINT: the function you are looking for works like a zipper With concatenation of lists. Commented Feb 2, 2014 at 17:48
  • Thank you so much!! looks like the zipWith (++) function works my question! Commented Feb 2, 2014 at 17:50

2 Answers 2

5
zipWith (++) ["aaaaaa", "aaaaaa","aaaaaa"] ["bbbb", "bbbb", " bb"]
Sign up to request clarification or add additional context in comments.

Comments

4

You can use zipWith:

concatStrings :: [String] -> [String] -> [String]
concatStrings = zipWith (++)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.