Skip to content

Conversation

@psibi
Copy link

@psibi psibi commented Aug 6, 2014

Making the truthTable function to generate string without color as it seems the sensible default. (although it's debatable)

Added a function truthTablewithColor which will handle the coloured situations.

The primary motivation was for cases something like this:

import Data.Logic.Propositional
import System.IO

p = Variable (Var 'p')
q = Variable (Var 'q')

exp1 = (Negation p) `Disjunction` q
exp1T = truthTable exp1

main = writeFile "Table.txt" exp1T

The output produced earlier was like this:

p q | (¬p ∨ q)

�[92mT�[0m �[92mT�[0m | �[92mT�[0m
�[92mT�[0m �[91mF�[0m | �[91mF�[0m
�[91mF�[0m �[92mT�[0m | �[92mT�[0m
�[91mF�[0m �[91mF�[0m | �[92mT�[0m

After the patch, it will produce like this:

p q | (¬p ∨ q)

T T | T
T F | F
F T | T
F F | T

seems the sensible default. (although it's debatable)

Added a function truthTablewithColor which will handle the coloured
situations.

The primary motivation was for cases something like this:

import Data.Logic.Propositional
import System.IO

p = Variable (Var 'p')
q = Variable (Var 'q')

exp1 = (Negation p) `Disjunction` q
exp1T = truthTable exp1

main = writeFile "Table.txt" exp1T

The output produced earlier was like this:

p q | (¬p ∨ q)
--------------
�[92mT�[0m �[92mT�[0m | �[92mT�[0m
�[92mT�[0m �[91mF�[0m | �[91mF�[0m
�[91mF�[0m �[92mT�[0m | �[92mT�[0m
�[91mF�[0m �[91mF�[0m | �[92mT�[0m

After the patch, it will produce like this:

p q | (¬p ∨ q)
--------------
T T | T
T F | F
F T | T
F F | T
@beastaugh
Copy link
Owner

Thanks, this looks like a sensible change. I'll try to find some time this week to merge it and publish a new version.

@psibi
Copy link
Author

psibi commented Aug 12, 2015

Ping @beastaugh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants