Skip to content

Instantly share code, notes, and snippets.

@bolo1729
Last active August 29, 2015 14:02
Show Gist options
  • Save bolo1729/90718aacae8b3adf0e63 to your computer and use it in GitHub Desktop.
Save bolo1729/90718aacae8b3adf0e63 to your computer and use it in GitHub Desktop.
Correct link
-- 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