RewriteRule(Base, R, F)¶
rule.spad line 1 [edit on github]
Base: SetCategory
R: Join(Ring, PatternMatchable Base, Comparable, ConvertibleTo Pattern Base)
F: Join(FunctionSpace R, PatternMatchable Base, ConvertibleTo Pattern Base)
Rules for the pattern matcher Author: Manuel Bronstein Date Created: 24 Oct 1988 Keywords: pattern, matching, rule.
- coerce: % -> OutputForm
from CoercibleTo OutputForm
- coerce: Equation F -> %
from CoercibleFrom Equation F
- elt: (%, F, PositiveInteger) -> F
elt(r, f, n)
orr
(f
,n
) applies the ruler
tof
at mostn
times.
- latex: % -> String
from SetCategory
- lhs: % -> F
lhs(r)
returns the left hand side of the ruler
.
- pattern: % -> Pattern Base
pattern(r)
returns the pattern corresponding to the left hand side of the ruler
.
- quotedOperators: % -> List Symbol
quotedOperators(r)
returns the list of operators on the right hand side ofr
that are considered quoted, that is they are not evaluated during any rewrite, but just applied formally to their arguments.
- retract: % -> Equation F
from RetractableTo Equation F
- retractIfCan: % -> Union(Equation F, failed)
from RetractableTo Equation F
- rhs: % -> F
rhs(r)
returns the right hand side of the ruler
.
- rule: (F, F) -> %
rule(f, g)
creates the rewrite rule:f == eval(g, g is f)
, with left-hand sidef
and right-hand sideg
.
- rule: (F, F, List Symbol) -> %
rule(f, g, [f1, ..., fn])
creates the rewrite rulef == eval(eval(g, g is f), [f1, ..., fn])
, that is a rule with left-hand sidef
and right-hand sideg
; The symbolsf1
, …,fn
are the operators that are considered quoted, that is they are not evaluated during any rewrite, but just applied formally to their arguments.
- suchThat: (%, List Symbol, List F -> Boolean) -> %
suchThat(r, [a1, ..., an], f)
returns the rewrite ruler
with the predicatef(a1, ..., an)
attached to it.
Eltable(F, F)