David F. Place wrote: > main' n = let p = permutations [1..n] > in do mapM_ (putStrLn . concatMap show) $ take 30 p > putStr $ "Pfannkuchen(" ++ show n ++ ") = " > putStrLn . show $ foldl' (flip (max . > steps 0)) 0 p > > In the original version, the author called 'permutations' twice and > didn't create a variable binding.
As a side note, I expected GHC to do common subexpression elimination and evaluate permutations [1..n] only once, caching the 30 results that are used twice. I didn't try to find out whether it actually did though. Bertram _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe