dusa
dusa copied to clipboard
Or-patterns
A common logic programming idiom is to allow a pattern to be matched one of multiple ways. This rule:
q X Y :-
a X,
(b Y; c Y),
d X Z.
is equivalent to these two rules
q X Y :-
a X,
b Y,
d X Z.
q X Y :-
a X,
c Y,
d X Z.
I haven't run into cases where lacking this feature has felt super painful, but I think it's a pretty easy thing to implement on the language frontend, though it could require some of the finer invariants in the flatten/binarize/indexize transformations to be modified.