PatternFunctions1(R, D)¶

Tools for patterns.

addBadValue(p, v) adds v to the list of “bad values” for p; p is not allowed to match any of its “bad values”.
badValues: Pattern R -> List D
badValues(p) returns the list of “bad values” for p; p is not allowed to match any of its “bad values”.
predicate: Pattern R -> D -> Boolean
predicate(p) returns the predicate attached to p, the constant function true if p has no predicates attached to it.
satisfy?: (D, Pattern R) -> Boolean
satisfy?(v, p) returns f(v) where f is the predicate attached to p.
satisfy?: (List D, Pattern R) -> Boolean
satisfy?([v1, ..., vn], p) returns f(v1, ..., vn) where f is the top-level predicate attached to p.
suchThat: (Pattern R, D -> Boolean) -> Pattern R
suchThat(p, f) makes a copy of p and adds the predicate f to the copy, which is returned.
suchThat: (Pattern R, List D -> Boolean) -> Pattern R
suchThat(p, [f1, ..., fn]) makes a copy of p and adds the predicate f1 and ... and fn to the copy, which is returned.
suchThat: (Pattern R, List Symbol, List D -> Boolean) -> Pattern R
suchThat(p, [a1, ..., an], f) returns a copy of p with the top-level predicate set to f(a1, ..., an).