
Kaoru Hosokawa (khosokawa@gmail.com) wrote:
I hope to find a better solution. I googled but couldn't find the answer.
Here is what I have. I do not have working Haskell interpreter at the moment (being on amd64), but this is what I have in my archive: weakAscendingOrder :: Int -> Int -> Int -> Bool weakAscendingOrder a b c | (a < b) && (b == c) || (a == b) && (b < c) = True | otherwise = False howManyEqual :: Int -> Int -> Int -> Int howManyEqual a b c | (a == b ) && (b == c) = 3 | weakAscendingOrder a b c = 2 | (a /= b) && (b /= c) = 0 isEqual :: Int -> Int -> Int -> Int -> Bool isEqual x a b c | (x == a) = True | (x == b) = True | (x == c) = True | otherwise = False howManyOfFourEqual :: Int -> Int -> Int -> Int -> Int howManyOfFourEqual a b c d | isEqual a b c d = howManyEqual b c d + 1 | otherwise = howManyEqual b c d Pls. test it ;) Sincerely, Gour -- Registered Linux User | #278493 GPG Public Key | 8C44EDCD