Last active
August 29, 2015 14:02
-
-
Save bolo1729/90718aacae8b3adf0e63 to your computer and use it in GitHub Desktop.
Correct link
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- A solution for this problem: https://plus.google.com/101293528673868443204/posts/BCspgEwvkWY | |
import Control.Monad (replicateM) | |
import Data.List (group, sort) | |
combinations = replicateM 8 [1..6] | |
signature :: Ord a => [a] -> [Int] | |
signature = sort . map length . group . sort | |
condP1 :: [Int] -> Bool | |
condP1 = (==) [2, 2, 2, 2] . signature | |
condP2 :: [Int] -> Bool | |
condP2 = (==) [4, 4] . signature | |
main :: IO () | |
main = do | |
print (length combinations) | |
print (length (filter condP1 combinations)) | |
print (length (filter condP2 combinations)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment