dusa icon indicating copy to clipboard operation
dusa copied to clipboard

Or-patterns

Open robsimmons opened this issue 1 year ago • 0 comments

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.

robsimmons avatar Oct 21 '24 17:10 robsimmons