Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Or-patterns #56

Open
robsimmons opened this issue Oct 21, 2024 · 0 comments
Open

Or-patterns #56

robsimmons opened this issue Oct 21, 2024 · 0 comments

Comments

@robsimmons
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant