Home / Logic / Truth table / Implementation / Function scheme/truth-table
Test
<<scheme/truth-table>>
(unless (equal? (truth-table not 1)
'((#f #t)
(#t #f)))
(raise #f))
(unless (equal? (truth-table (lambda (p q) (and p q)) 2)
'((#f #f #f)
(#f #t #f)
(#t #f #f)
(#t #t #t)))
(raise #f))
(unless (equal? (truth-table (lambda (p q r) (or p q r)) 3)
'((#f #f #f #f)
(#f #f #t #t)
(#f #t #f #t)
(#f #t #t #t)
(#t #f #f #t)
(#t #f #t #t)
(#t #t #f #t)
(#t #t #t #t)))
(raise #f))
"tests passed"
tests passed