Currently, orderless matching simply tries all permutations of arguments:
https://github.com/HarrisonGrodin/Rewrite.jl/blob/03af1708d18f17efbc6e604b58c4d4943930607b/src/match.jl#L138-L146
This is clearly inefficient. We should be able to take advantage of the fact that OrderRule will sort all ground terms, thus requiring us only to attempt all possible variable positionings when matching.
Currently, orderless matching simply tries all permutations of arguments:
https://github.com/HarrisonGrodin/Rewrite.jl/blob/03af1708d18f17efbc6e604b58c4d4943930607b/src/match.jl#L138-L146
This is clearly inefficient. We should be able to take advantage of the fact that
OrderRulewill sort all ground terms, thus requiring us only to attempt all possible variable positionings when matching.