RelationalAI-oss / Rematch.jl

Pattern matching
Other
52 stars 6 forks source link

More general list matching #7

Open mbravenboer opened 6 years ago

mbravenboer commented 6 years ago

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: