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.
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: