type Weight = (Int,Int,Int)
weight :: Results -> Weight
weight (Results _ scores) =
(sum (map points scores),
sum [gf - ga | (gf,ga) <- scores],
sum (map fst scores))
where
points (gf,ga)
| gf > ga = 3
| gf == ga = 1
| otherwise = 0The components are total points, total goal difference and total goals scored. The Haskell Ord class compares tuples in lexicographic order, so a greater first component dominates all later components; only ties reach the next criterion. Exactly equal triples remain tied because no further ranking criterion was specified. In the supplied fixture data the descending triples are , , , , , and , respectively for United, Athletic, City, Albion, Rovers, Corinthians and Thistle.
Articles by others on the same topic
There are currently no matching articles.