||
||	for jwj, based on a Miranda past paper question
||

vote  ::= For | Against | Abstain

summary :: [vote] -> (num, num, num)
	summary []    = (0,0,0)
	summary (h:t) = (1,0,0) $plus summary t, if h=For
                      = (0,1,0) $plus summary t, if h=Against
                      = (0,0,1) $plus summary t, if h=Abstain
			where
			(a1,b1,c1) $plus (a2,b2,c2) = (a1+a2, b1+b2, c1+c2)



majority :: [bool] -> num
	majority l = foldr absorb_one 0 l
			where
			absorb_one True  n = n+1
			absorb_one False n = n-1

orig_majority :: [bool] -> num
	orig_majority []    = 0
	orig_majority (h:t) = orig_majority t + 1, if h
	                    = orig_majority t - 1, if ~h
