#g --
[1] List archive: http://www.haskell.org/pipermail/haskell-cafe/
[2] Powerset thread starts: http://www.haskell.org/pipermail/haskell-cafe/2003-June/004463.html
(Read into the thread, because there are some problems with the code that appears earlier in the thread.)
At 22:55 19/07/03 -0300, Douglas O. Matoso wrote:
Hi,
I have an school assignment that asks to implement an truth table of propositional formulas. I'm having difficulties in the following part:
data Prop = Var Char | Not Prop | And Prop Prop | Or Prop Prop type Subst = [(Char,Bool)]
- Define a function bools :: Int -> [[Bool]] that calculates all possible lists of logical values of a specific length. For example, bools 2 should give the following list: [[False,False], [False,True ], [True ,False], [True ,True ]]
- Define a function substs :: Prop -> [Subst] that calculates all possible substitutions for the variables of a proposition.
For example, substs p2 should give the following list: [[('A',False),('B',False)], [('A',False),('B',True) ], [('A',True) ,('B',False)], [('A',True) ,('B',True) ]]
I would be thankful for any help.
Douglas Matoso
************************************************************************************************** ** Este email foi scaneado contra virus e conteudo malicioso ** **************************************************************************************************
_______________________________________________ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe
------------------- Graham Klyne <[EMAIL PROTECTED]> PGP: 0FAA 69FF C083 000B A2E9 A131 01B9 1C7A DBCA CB5E
_______________________________________________ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe