[plt-scheme] Creating new syntax for decision tables
Oops, left in a silly bug. Here you go:
(module m mzscheme
(define-syntax (table stx)
(syntax-case stx (:)
[(_ clauses ...)
(let* ([transpose (λ (l) (apply map list l))]
[rewrite-clauses
(λ (clause)
(syntax-case clause (:)
[(var : tfs ...)
(map
(λ (tf)
(syntax-case tf (T F)
[T #'var]
[F #'(not var)]
[* #'#t]))
(syntax->list (syntax (tfs ...))))]))])
(with-syntax ([((item ...) ...)
(transpose (map rewrite-clauses
(syntax->list (syntax (clauses
...)))))])
#'(or (and item ...) ...)))]))
(λ (a b c)
(table
(a : T T F)
(b : F * F)
(c : * F T))))