{- Simple Haskell program to solve the Four Fours puzzle. Namely: express each integer between 1 and 100 using standard operations and exactly four fours Copyright: © 2006 Joachim Breitner (eval t,t)) all_combos -- To search for a specify number, and print the result search_for n = case lookup (fromInteger n) evaled_combos of Just found -> show n ++ ": " ++ show found Nothing -> show n ++ ": not found" -- Search for all requested numbers and append newlines result = unlines $ map search_for [1..100] -- For fun: First not found number: notfound = show $ head $ dropWhile (\n -> isJust $ lookup (fromInteger n) evaled_combos) [1..] -- Main function main = do putStr result >> putStrLn "And so on until: " >> putStrLn notfound