This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.List hiding (nub) | |
import Prelude hiding (gcd) | |
-- FreeCHR Instance | |
newtype SolverStep c = SolverStep { runSolverStep :: [c] -> [c] } | |
match :: [a -> Bool] -> [a] -> [[a]] | |
match ps as = [ as'' | |
| as' <- subsequences as, length as' == length ps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itertools import permutations | |
def match(pattern, constraints): | |
return (perm | |
for perm in permutations(constraints, len(pattern)) | |
if all(p(c) for p, c in zip(pattern, perm)) | |
) |