Note this is not the same as using the words function.
I would like to convert from this:
"The quick brown fox jumped over the lazy dogs." into this:
["The"," quick"," brown"," fox"," jumped"," over"," the"," lazy"," dogs."] Note how the breaks are on the first space after each word.
The best I could come up with is this:
parts "" = [] parts s = if null a then (c ++ e):parts f else a:parts b where (a, b) = break isSpace s (c, d) = span isSpace s (e, f) = break isSpace d It just looks a little inelegant. Can anyone think of a better way to express this?
wordsfunction, so maybe you should look at howwordsis implemented and see if you can do something similar.