diff --git a/books/bookvol10.3.pamphlet b/books/bookvol10.3.pamphlet index 78cef74..8aac133 100644 --- a/books/bookvol10.3.pamphlet +++ b/books/bookvol10.3.pamphlet @@ -111003,7 +111003,7 @@ Result():Exports==Implementation where )set message auto off )clear all ---S 1 of 1 +--S 1 of 4 )show RewriteRule --R RewriteRule(Base: SetCategory,R: Join(Ring,PatternMatchable Base,OrderedSet,ConvertibleTo Pattern Base),F: Join(FunctionSpace R,PatternMatchable Base,ConvertibleTo Pattern Base)) is a domain constructor --R Abbreviation for RewriteRule is RULE @@ -111024,6 +111024,27 @@ Result():Exports==Implementation where --R --E 1 +--S 2 of 4 +logrule := rule log(x) + log(y) == log(x*y) +--R +--R (1) log(y) + log(x) + %B == log(x y) + %B +--R Type: RewriteRule(Integer,Integer,Expression Integer) +--E 2 + +--S 3 of 4 +f := log(sin(x)) + log(x) +--R +--R (2) log(sin(x)) + log(x) +--R Type: Expression Integer +--E 3 + +--S 4 of 4 +logrule f +--R +--R (3) log(x sin(x)) +--R Type: Expression Integer +--E 4 + )spool )lisp (bye) @ @@ -111031,6 +111052,31 @@ Result():Exports==Implementation where ==================================================================== RewriteRule examples ==================================================================== +For example: + +logrule := rule log(x) + log(y) == log(x*y) + log(y) + log(x) + %C == log(x y) + %C + +f := log(sin(x)) + log(x) + log(sin(x)) + log(x) + +logrule f + log(x sin(x)) + + +Note that you cannot write the simple form of a rule as: + +rule1 := rule a*x+b == b*x+a + +as this causes an infinite loop. The pattern is properly matched +but the result also properly matches and the pattern is applied +again. + + +See Also: +o )show ApplyRules + +@ See Also: o )show RewriteRule @@ -111084,6 +111130,10 @@ RewriteRule(Base, R, F): Exports == Implementation where rule : (F, F) -> $ ++ rule(f, g) creates the rewrite rule: \spad{f == eval(g, g is f)}, ++ with left-hand side f and right-hand side g. + ++ + ++X logrule := rule log(x) + log(y) == log(x*y) + ++X f := log(sin(x)) + log(x) + ++X logrule f rule : (F, F, List Symbol) -> $ ++ rule(f, g, [f1,...,fn]) creates the rewrite rule ++ \spad{f == eval(eval(g, g is f), [f1,...,fn])}, diff --git a/changelog b/changelog index 3e71e24..9b18eab 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,5 @@ +20110713 tpd src/axiom-website/patches.html 20110713.01.tpd.patch +20110713 tpd books/bookvol10.3 help and unit tests for RewriteRule 20110712 tpd src/axiom-website/patches.html 20110712.01.tpd.patch 20110712 tpd src/interp/lisplib.lisp move function from modemap.lisp 20110712 tpd src/interp/modemap.lisp removed file diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html index b737b78..22b3127 100644 --- a/src/axiom-website/patches.html +++ b/src/axiom-website/patches.html @@ -3538,5 +3538,7 @@ books/bookvol9 treeshake compiler
books/bookvol9 treeshake compiler
20110712.01.tpd.patch books/bookvol9 treeshake compiler, remove modemap.lisp
+20110713.01.tpd.patch +books/bookvol10.3 help and unit tests for RewriteRule