1 -- | The Misc module contains helper functions that seem out of place
7 -- | The standard factorial function. See
8 -- <http://www.willamette.edu/~fruehr/haskell/evolution.html> for
9 -- possible improvements.
10 factorial :: Int -> Int
13 | n > 20 = error "integer overflow in factorial function"
14 | otherwise = product [1..n]
17 -- | Takes a three-dimensional list, and flattens it into a
18 -- one-dimensional one.
19 flatten :: [[[a]]] -> [a]
20 flatten xs = concat $ concat xs