I have to match on data (HTTP headers) that may arrive in any order. What would be the elegant and performant way to do such pattern match?
F.e. say we have to match on these 3 values: <<a>>, <<b>>, <<c>>. Each known beforehand, yet with an indeterminate ordering. Is there any better way than to just write/generate out all the function heads, 6 in this case?
The function you wrote doesn’t do what you described you wanted.
What you’ve done is match a variable a and a variable b, both a single byte width. What the text you wrote described was to match specific values in any order. So it’d be more like match("foo:" <> foo_value <> "bar:" <> bar_value) but where foo and bar happen in any order. This is not possible to construct in a single match head, but @LostKobrakai’s solution works.
Give it a whirl! Evolve your example from matching on just 2 bytes and do something more like an HTTP header string.