PatternMatch(Base, Subject, Pat)¶
patmatch1.spad line 879 [edit on github]
Base: SetCategory
Subject: PatternMatchable Base
Pat: ConvertibleTo Pattern Base
This package provides the top-level pattern matching 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 expressionexpr
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 expressionexpr
and returns a list of matches[v1 = e1, ..., vn = en]
; returns an empty list if eitherexpr
is exactly equal to pat or if pat does not matchexpr
.
- Is: (Subject, Pat) -> List Equation Subject if Subject has RetractableTo Symbol
Is(expr, pat)
matches the pattern pat on the expressionexpr
and returns a list of matches[v1 = e1, ..., vn = en]
; returns an empty list if eitherexpr
is exactly equal to pat or if pat does not matchexpr
.
- 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 expressionexpr
and returns a match of the form[v1 = e1, ..., vn = en]
; returns an empty match ifexpr
is exactly equal to pat. returns a failed match if pat does not matchexpr
.