[plt-scheme] Creating new syntax for decision tables

From: Andrew Gacek (andrew.gacek at gmail.com)
Date: Thu Feb 8 17:56:43 EST 2007


I would like to introduce new syntax into scheme which would allow for
more concise descriptions of large boolean formulas of a certain type.
Specifically, I would like to be able to say something like

  (a : T T F)
  (b : F * F)
  (c : * F T))

Where each column going down represents a possible way this table
might be true. For instance the first row is true if a is true and b
is false (the * means we don't care about the value of c). Thus I
would like the above expression to expand to,

  (and a (not b) #t)
  (and a #t (not c))
  (and (not a) (not b) c))

I ran into two problems doing this. The first was that I didn't know
how to convert the T, F, and * into appropriate transformations. The
second is that the macro needs to expand one column at a time, but the
"..." notation in scheme seems to favor expanding things one row at a

Andrew Gacek

Posted on the users mailing list.