Dear Kyle, I've recevied the following program. You did a fantastic job of explaining the other one, but as you said it wasn't a great approach, if you have a moment could you explain this one?
doorOpen :: Int -> Bool doorOpen door = doh door door doh :: Int -> Int -> Bool doh door 0 = True doh door pass = if (door `rem` (pass+1)) == pass then not (doh door (pass-1)) else doh door (pass-1) doors :: [Bool] doors = [doorOpen n | n <- [0..]] printDoor :: (Int,Bool) -> IO () printDoor (door,open) = putStrLn ("Door #" ++ (show door) ++ " is " ++ if open then "open." else "closed.") printUpTo :: Int -> IO () printUpTo n = mapM_ printDoor (zip [0..(n-1)] doors) printUpTo 100 Kind regards, Samuel _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe