You might start with looking into <a href="http://haskell.org/ghc/docs/latest/html/libraries/base-4.2.0.0/Prelude.html#v:span">span</a>.<br><br><span style="font-family: courier new,monospace;">span :: (a -> Bool) -> [a] -> ([a], [a])</span><br>
<br><br>For example try these,<br><br style="font-family: courier new,monospace;"><div style="margin-left: 40px;"><span style="font-family: courier new,monospace;">span ('a'==) "abcd"</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">span ('a'==) "aaabcd"</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">span ('c'==) "abcd"</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">span ('c'/=) "abcd"</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">span ('c'/=) "abcdcdcd"</span><br>
</div><br><br><br><div class="gmail_quote">On 16 March 2010 17:08, Roger Whittaker <span dir="ltr"><<a href="mailto:roger@disruptive.org.uk">roger@disruptive.org.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
I found some exam papers linked from this page:<br>
<a href="http://www.cs.chalmers.se/Cs/Grundutb/Kurser/d1pt/d1pta/external.html" target="_blank">http://www.cs.chalmers.se/Cs/Grundutb/Kurser/d1pt/d1pta/external.html</a><br>
<br>
And I have been trying some questions from them.<br>
<br>
I'm currently baffled by question 2(b) on this one:<br>
<a href="http://www.cs.chalmers.se/Cs/Grundutb/Kurser/d1pt/d1pta/tenta2000-04.ps" target="_blank">http://www.cs.chalmers.se/Cs/Grundutb/Kurser/d1pt/d1pta/tenta2000-04.ps</a><br>
<br>
A word is a sequence of alphabetic characters, which you can recognise<br>
using the standard function<br>
<br>
isAlpha :: Char -> Bool<br>
<br>
Using span, define a function words :: String -> [String] which<br>
finds a list of the words occurring in a string. For example,<br>
<br>
words "Now is the winter of our discontent!"<br>
== ["Now","is","the","winter","of","our","discontent"]<br>
<br>
words "2+3" == []<br>
<br>
words "1 by 1" == ["by"]<br>
<br>
Can anyone give me a clue how to start?<br>
<br>
<br>
<br>
<br>
--<br>
========================<br>
<font color="#888888">Roger Whittaker<br>
<a href="mailto:roger@disruptive.org.uk">roger@disruptive.org.uk</a><br>
<a href="http://disruptive.org.uk" target="_blank">http://disruptive.org.uk</a><br>
========================<br>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Ozgur Akgun<br>