[Haskell-cafe] Newbie: generating a truth table

Joe Thornber joe.thornber at gmail.com
Wed Feb 21 03:47:46 EST 2007


> On 2/10/07, Peter Berry <pwberry at gmail.com> wrote:
> Prelude> putStrLn $ concatMap (flip (++)"\n") $ map show $ [(x,y,(&&) x y)
> |x <- [True,False],y <- [True,False]]

This can be simplified slightly to:

Prelude > putStrLn . unlines . map show $ [(x, y, x && y) | x <-
[True, False], y <- [True, False]]


- Joe


More information about the Haskell-Cafe mailing list