On 2/10/07, Peter Berry <pwberry@gmail.com> wrote:
Sigh, I seem to have done a reply to sender. Reposting to the list.

On 06/02/07, phiroc@free.fr <phiroc@free.fr> wrote:
> Hello,
>
> I would like to create a Haskell function that generates a truth table, for
> all Boolean values, say, using the following "and" function :
>
> and :: Bool -> Bool -> Bool
> and a b = a && b



This is solution that I used with list comprehension.. combining some of the other ideas on the thread such as a tuple to see the original values and then the result.

Prelude> putStrLn $ concatMap (flip (++)"\n") $ map show $ [(x,y,(&&) x y) |x <- [True,False],y <- [True,False]]
(True,True,True)
(True,False,False)
(False,True,False)
(False,False,False)

gene