[Haskell-cafe] missed clause???

Ryan Bloor ryanbloor at hotmail.com
Sun Nov 11 06:37:06 EST 2007


hi
 
I was testing my code when I came across a strange predicament. The input is a list of ints and a Results type which is of type [(int,.......),(Int......)......]. I am comparing each int from the list to the first element in each member of results. But it works for 1-9 but not for 10 onwards.... why? 
Have I missed a clause anywhere...... it only does the first one after that. 
 
--Print the points of eight games
poolsPoints :: [Int] -> Results -> Int
poolsPoints [] [] = 0
poolsPoints [] _ = 0
poolsPoints _ [] = 0
poolsPoints (x:xs) ((a,b,c,d,e):t) 
| (x == a && c>d) = 1 + poolsPoints xs t
| (x == a && c<d) = 1 + poolsPoints xs t
| (x == a && c==0 && d==0) = 2 + poolsPoints xs t
| (x == a && c==d && c>0) = 3 + poolsPoints xs t
| otherwise = 0 + poolsPoints [x] t
 
Thanks
 
Ryan
_________________________________________________________________
The next generation of MSN Hotmail has arrived - Windows Live Hotmail
http://www.newhotmail.co.uk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20071111/366c40ca/attachment.htm


More information about the Haskell-Cafe mailing list