I need to be able to write a function that shows repeated words from a string and return a list of strings in order of its occurrence and ignore non-letters
e.g at hugs prompt
repetitions :: String -> [String] repetitions > 'My bag is is action packed packed.' output> ['is','packed'] repetitions > 'My name name name is Sean .' output> ['name','name'] repetitions > 'Ade is into into technical drawing drawing .' output> ['into','drawing']
To split a string into words, use the
wordsfunction (in the Prelude). To eliminate non-word characters,filterwithData.Char.isAlphaNum. Zip the list together with its tail to get adjacent pairs(x, y). Fold the list, consing a new list that contains allxwherex==y.Someting like:
I’m not sure that works, but it should give you a rough idea.