[Haskell-cafe] missed clause???
ryanbloor at hotmail.com
Sun Nov 11 06:37:06 EST 2007
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
The next generation of MSN Hotmail has arrived - Windows Live Hotmail
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe