-- Puzzle -- 1. product of ages is 36 -- 2. Turing knows the sum of the ages, but cannot work it out yet... -- 3. The oldest child has red hair - now Turing can work it out ages = (clue3 . clue2 . clue1) allPossible allAges = [0..100] :: [Int] allPossible :: [[Int]] allPossible = [[a,b,c] | a <- allAges, b <- filter (>= a) allAges, c <- filter (>= b) allAges] clue1 = filter ((==36) . product) clue2 = map (\ages -> (sum ages, ages)) clue3 = id