All we need are columns labeled with conditions. We don't need rows. And the matrix can just have true/false/don't-care entries, with code assigned to rows.
Concretely, say we have these conditions:
(> x y) (stringp foo) (oddp n)
Right? Okay, so now we can identify the combinations of these and assign them to code like this: (> x y) (stringp foo) (oddp n)
#t #t (whatever)
#t #t (other-thing)
#t #f (etc)
There could be a way to mark some of the rows as having "fall through" behavior. If they match, the expression is evaluated (for its side effects, obviously), but then subsequent rows can still match.This could be worked into a straightforward S-exp syntax without any diagramming shennanigans:
(table-cond
(> x y) (stringp foo) (oddp n)
#t () #t (let [...]
(whatever))
() #t #t (other-thing)
#t #f () (etc))
Here, don't cares are denoted using (). Something else could be chosen.A #f entry means "must be explicitly false". A blank column entry is a "don't care"; that condition is not taken into account for that row.