PatternMatch(Base, Subject, Pat)

patmatch1.spad line 879 [edit on github]

This package provides the top-level pattern macthing functions.

is?: (List Subject, Pat) -> Boolean

is?([e1, ..., en], pat) tests if the list of expressions [e1, ..., en] matches the pattern pat.

is?: (Subject, Pat) -> Boolean

is?(expr, pat) tests if the expression expr matches the pattern pat.

Is: (List Subject, Pat) -> PatternMatchListResult(Base, Subject, List Subject)

Is([e1, ..., en], pat) matches the pattern pat on the list of expressions [e1, ..., en] and returns the result.

Is: (Subject, Pat) -> List Equation Polynomial Subject if Subject hasn’t RetractableTo Symbol and Subject has Ring

Is(expr, pat) matches the pattern pat on the expression expr and returns a list of matches [v1 = e1, ..., vn = en]; returns an empty list if either expr is exactly equal to pat or if pat does not match expr.

Is: (Subject, Pat) -> List Equation Subject if Subject has RetractableTo Symbol

Is(expr, pat) matches the pattern pat on the expression expr and returns a list of matches [v1 = e1, ..., vn = en]; returns an empty list if either expr is exactly equal to pat or if pat does not match expr.

Is: (Subject, Pat) -> PatternMatchResult(Base, Subject) if Subject hasn’t RetractableTo Symbol and Subject hasn’t Ring

Is(expr, pat) matches the pattern pat on the expression expr and returns a match of the form [v1 = e1, ..., vn = en]; returns an empty match if expr is exactly equal to pat. returns a failed match if pat does not match expr.