PatternMatchTools(S, R, P)ΒΆ
patmatch1.spad line 410 [edit on github]
S: SetCategory
R: Join(Comparable, Ring)
P: Join(Ring, ConvertibleTo Pattern S, RetractableTo R)
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 patternslpat
to the list of subjectslsubj
, allowing for commutativity;op
is the operator such thatop
(lpat
) should matchop
(lsubj
) at the end,r
contains the previous matches, and match is a pattern-matching function onP
.
- 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 patternsreduce(*, lpat)
to the product of subjectsreduce(*, lsubj)
;r
contains the previous matches and match is a pattern-matching function onP
.