Rudy’s OBTF Rudolf Adamkovič

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

© 2025 Rudolf Adamkovič under GNU General Public License (GPL) version 3 or later.
Made with Emacs and secret alien technologies of yesteryear.