<br><br><div class="gmail_quote">On Nov 10, 2007 11:54 AM, Ryan Bloor <<a href="mailto:ryanbloor@hotmail.com">ryanbloor@hotmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>hiya<br>
<br>
I was wondering how I would get the second function do recursively do the function for poolNews xs.... tried that and it fails. <br>
<br>
Ryan<br>
<br>
<br><font color="#8080c0" size="2">
<p align="left">--Give wins, draws a rating.</p>
<p align="left"> </p></font><font size="2">
<p align="left">poolNews :: Result </p></font><b><font color="#0000c4" face="" size="2">-></font></b><font face="" size="2"> PoolNews </font><b><font color="#0000c4" face="" size="2">-></font></b><font face="" size="2">
PoolNews
<p align="left">poolNews (a,b,c,d,e) (home,away,goaless,scoredraw) </p>
<p align="left"> | c > d = (home+1,away,goaless,scoredraw) </p>
<p align="left"> | c < d = (home,away+1,goaless,scoredraw) </p>
<p align="left"> |(c == 0) && (d == 0) = (home+1,away,goaless+1,scoredraw) </p>
<p align="left"> | </p></font><b><font color="#40c0c0" size="2">otherwise</font></b><font face="" size="2"> = (home,away,goaless,scoredraw+1)</font>
<p align="left"><font face="" size="2"> </font></p>
<p align="left"></p>
<p align="left"><font color="#8080c0" size="2">--Do for all Results</font></p><font size="2">
<p align="left">poolNewsB :: Results </p></font><b><font color="#0000c4" face="" size="2">-></font></b><font face="" size="2"> PoolNews
poolNewsB (x:xs) = poolNews x (0,0,0,0)<br></font></div></blockquote><br>As Andrew points out, really what you want is a fold. However, perhaps you're not supposed to use such Prelude functions in your assignment? The real issue here is that your definition of poolNewsB does not do anything with xs. You need to somehow incorportate a recursive call that will process the rest of the list (xs) as well as the first item (x).
<br><br>Hope that helps!<br>-Brent<br></div>