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

More general list matching #7

Open
mbravenboer opened this issue Sep 4, 2018 · 0 comments
Open

More general list matching #7

mbravenboer opened this issue Sep 4, 2018 · 0 comments

Comments

@mbravenboer
Copy link
Contributor

It would be really nice if we could write patterns like this:

[xs..., p(x), ys...]

This would match the first p(x) in the list. It's important here that matching is not greedy. Some ad-hoc support could be implement, but it gets quickly more challenging to cover all cases correctly. I believe we should compile the patterns into an automaton like regular expressions. The design of this would need to be worked out in some more detail.

Some quick thoughts:

  • P... would be like P* , and P should match the elements, not the entire list.
  • It would be nice to support more regular expression operators, but we'd have to get a bit creative with mapping those Julia syntax? I don't immediately see great use-cases for those.
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