PatternMatchTools(S, R, P)ΒΆ

patmatch1.spad line 410 [edit on github]

This package provides tools for the pattern matcher.

patternMatch: (List P, List Pattern S, List P -> P, PatternMatchResult(S, P), (P, Pattern S, PatternMatchResult(S, P)) -> PatternMatchResult(S, P)) -> PatternMatchResult(S, P)

patternMatch(lsubj, lpat, op, res, match) matches the list of patterns lpat to the list of subjects lsubj, allowing for commutativity; op is the operator such that op(lpat) should match op(lsubj) at the end, r contains the previous matches, and match is a pattern-matching function on P.

patternMatchTimes: (List P, List Pattern S, PatternMatchResult(S, P), (P, Pattern S, PatternMatchResult(S, P)) -> PatternMatchResult(S, P)) -> PatternMatchResult(S, P)

patternMatchTimes(lsubj, lpat, res, match) matches the product of patterns reduce(*, lpat) to the product of subjects reduce(*, lsubj); r contains the previous matches and match is a pattern-matching function on P.