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 I have tried creating a second function called "loop", which repeatedly calls "and", but it did not work, because, for some reason unknown to me, "do" does not like repeated function calls loop = do and True True and True False and False True and False False Is there a better way to repeatedly call "and"? Furthermore, is there a way in Haskell to loop through the Boolean values (True and False) and call "and" each time? Last but not least, in the "loop" function above, assuming that there is a way to repeatedly call the "and" function, how could you intersperse "printStr"s between the "and" calls? loop = do printStr("Calling and True True returns ") and True True printStr("Calling and True False returns ") and True False printStr("Calling and False True returns ") and False True printStr("Calling and False False returns ") and False False Many thanks. Best regards, phiroc _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe