Copyright | Copyright (C) 2021 Yoo Chung |
---|---|

License | GPL-3.0-or-later |

Maintainer | dev@chungyc.org |

Safe Haskell | Safe-Inferred |

Language | GHC2021 |

Part of Ninety-Nine Haskell Problems. Some solutions are in Solutions.P48.

# Documentation

tablen :: Int -> ([Bool] -> Bool) -> [[Bool]] Source #

Truth tables for logical expressions with an arbitrary number of variables.

Generalize `table`

in a way that the logical expression may contain any number of logical variables.
Define `tablen`

such that `tablen n f`

prints the truth table for the expression `f`

,
which contains `n`

logical variables.

### Examples

`>>>`

False False False False False False True False False True False False False True True True True False False False True False True True True True False False True True True True`printTablen $ tablen 3 (\[a,b,c] -> a `and'` (b `or'` c) `equ'` a `and'` b `or'` a `and'` c)`