|
|
last edited 16 years ago by Bill Page |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ||
Editor: Bill Page
Time: 2008/04/07 20:37:34 GMT-7 |
||
Note: Waldek's function |
changed: - print(coerceMap2E(f)$Lisp::OutputForm) - print(coerceMap2E(g)$Lisp::OutputForm) - EQ(coerceMap2E(f)$Lisp,coerceMap2E(g)$Lisp)$Lisp --print(coerceMap2E(f)$Lisp::OutputForm) --print(coerceMap2E(g)$Lisp::OutputForm) EQ(f,g)$Lisp changed: - (f = _+$S) => return 0$S -- Must force "newGoGet" by applying operations before comparison! f(0,0)=(0+0)$S and (f = _+$S) => return 0$S changed: - (f = _*$S) => return 1$S f(1,1)=(1*1)$S and (f = _*$S) => return 1$S
spad)abbrev package MYRED MyReduce MyReduce(S:Type): with myred: ((S,S)->S,List S) -> S == add -- Waldek's local helper function F ==> (S,S)->S ((f:F)=(g:F)):Boolean == --print(coerceMap2E(f)$Lisp::OutputForm) --print(coerceMap2E(g)$Lisp::OutputForm) EQ(f,g)$Lisp -- myred(f:(S,S)->S, x:List S):S == if empty? x then if S has AbelianMonoid then -- Must force "newGoGet" by applying operations before comparison! f(0,0)=(0+0)$S and (f = _+$S) => return 0$S if S has Monoid then f(1,1)=(1*1)$S and (f = _*$S) => return 1$S error "reducing over an empty list needs the 3 argument form" reduce(f, rest x, first x)
Compiling OpenAxiom source code from file /var/zope2/var/LatexWiki/5320925977799285168-25px001.spad using old system compiler. MYRED abbreviates package MyReduce ------------------------------------------------------------------------ initializing NRLIB MYRED for MyReduce compiling into NRLIB MYRED processing macro definition F ==> (S,S) -> S compiling local = : ((S,S) -> S,(S,S) -> S) -> Boolean MYRED;= is replaced by EQ Time: 0.01 SEC. compiling exported myred : ((S,S) -> S,List S) -> S ****** Domain: S already in scope augmenting S: (AbelianMonoid) ****** Domain: S already in scope augmenting S: (Monoid) Time: 0.08 SEC. (time taken in buildFunctor: 0) ;;; *** |MyReduce| REDEFINED ;;; *** |MyReduce| REDEFINED Time: 0 SEC. Cumulative Statistics for Constructor MyReduce Time: 0.09 seconds finalizing NRLIB MYRED Processing MyReduce for Browser database: --->-->MyReduce((myred (S (Mapping S S S) (List S)))): Not documented!!!! --->-->MyReduce(constructor): Not documented!!!! --->-->MyReduce(): Missing Description ------------------------------------------------------------------------ MyReduce is now explicitly exposed in frame initial MyReduce will be automatically loaded when needed from /var/zope2/var/LatexWiki/MYRED.NRLIB/code
axiommyred(+,[1,2,3])
(1) |
axiommyred(+,[])$MyReduce(Integer)
(2) |
axiommyred(*,[1,2,3])
(3) |
axiommyred(*,[])$MyReduce(Integer)
(4) |