
16 Mar
2010
16 Mar
'10
6:02 p.m.
Thanks for the suggestions - I think the idea was that you had to use a recursive definition in terms of span. I eventually did this, but didn't feel it was at all nice or elegant: import Data.Char mywords :: [Char] -> [[Char]] mywords l | ((snd (span isAlpha l)) == "" && (fst (span isAlpha l)) == "") = [] | ((snd (span isAlpha l)) == "" && (fst (span isAlpha l)) /= "") = [fst (span isAlpha l)] | (fst (span isAlpha l)) == "" = mywords (tail (snd (span isAlpha l))) | otherwise = [fst (span isAlpha l)] ++ mywords (tail (snd (span isAlpha l))) -- ======================== Roger Whittaker roger@disruptive.org.uk http://disruptive.org.uk ========================