On 2/10/07, Peter Berry <[EMAIL PROTECTED]> wrote:
Sigh, I seem to have done a reply to sender. Reposting to the list. On 06/02/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> 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
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe