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

Support variable unification in matche patterns #5

Open
Reilithion opened this issue Feb 8, 2018 · 1 comment
Open

Support variable unification in matche patterns #5

Reilithion opened this issue Feb 8, 2018 · 1 comment

Comments

@Reilithion
Copy link

When given an existing variable name in a pattern, matche appears to treat it as a new variable. Example:

(run 2 (q r) (matche (r) (((Foo ,q))) (((Bar ,q)))) (== q 'Qux))
'((Qux (Foo _.0)) (Qux (Bar _.0)))

I expected the output to be '((Qux (Foo Qux)) (Qux (Bar Qux))).

I glanced at the paper describing the implementation of matche, lambdae, and defmatche and the problems encountered therein, but this didn't look like one of them. Is this feature doable?

@Reilithion
Copy link
Author

Upon reflection (and reading an e-mail from B), I realize this is the expected and desirable behavior. Nevertheless, it would be nice to be able to support unification in matche patterns by referencing variables in the patterns themselves. Perhaps it would make sense to use different syntax when referencing a variable than when introducing one.

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