Advertisement
Fawers

join strings

Aug 20th, 2014
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- epiphany time.
  2. -- how to join strings with a separator using foldl1 and (++).
  3.  
  4. join :: String -> [String] -> String
  5. join sep strings = foldl1 (\a b -> a ++ sep ++ b) strings
  6.  
  7. -- ok, I'm finally beginning to think functionally.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement