[Haskell-beginners] Defining 'words' in terms of 'span'
Roger Whittaker
roger at disruptive.org.uk
Tue Mar 16 13:08:15 EDT 2010
I found some exam papers linked from this page:
http://www.cs.chalmers.se/Cs/Grundutb/Kurser/d1pt/d1pta/external.html
And I have been trying some questions from them.
I'm currently baffled by question 2(b) on this one:
http://www.cs.chalmers.se/Cs/Grundutb/Kurser/d1pt/d1pta/tenta2000-04.ps
A word is a sequence of alphabetic characters, which you can recognise
using the standard function
isAlpha :: Char -> Bool
Using span, define a function words :: String -> [String] which
finds a list of the words occurring in a string. For example,
words "Now is the winter of our discontent!"
== ["Now","is","the","winter","of","our","discontent"]
words "2+3" == []
words "1 by 1" == ["by"]
Can anyone give me a clue how to start?
--
========================
Roger Whittaker
roger at disruptive.org.uk
http://disruptive.org.uk
========================
More information about the Beginners
mailing list