Skip to content

mthom/truth-tables

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

truth-tables

truth-tables is used to produce truth tables from logical propositions. Propositions consist of either propositional variables (non-reserved Lisp symbols) or compound forms (lists headed by the symbols and, or, xor, ->, , <->, not and containing propositional variables and other compound forms).

and and or are variadic, not, ->, <-> and xor have the usual arities.

For example, running

(print-truth-table '(xor (-> p q) (and p (not q))))

produces

P | Q | (NOT Q) | (AND P (NOT Q)) | (-> P Q) | (XOR (-> P Q) (AND P (NOT Q))) 
T | T |       F |               F |        T |                              T 
T | F |       T |               T |        F |                              T 
F | T |       F |               F |        T |                              T 
F | F |       T |               F |        T |                              T 

This program flouts proper Lisp style and should not be viewed by anyone.

I should acknowledge Common Lisp Tips, from which I took several helpful ideas and techniques.

About

"Not chef"-quality truth table generator.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published