|
|
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 19:53:29 GMT-7 |
||
Note: Waldek's function |
changed: - ((f:F)=(g:F)):Boolean == devaluate(g)$Lisp=devaluate(f)$Lisp ((f:F)=(g:F)):Boolean == print(coerceMap2E(f)$Lisp::OutputForm) print(coerceMap2E(g)$Lisp::OutputForm) EQ(coerceMap2E(f)$Lisp,coerceMap2E(g)$Lisp)$Lisp changed: - (f = _+) => return 0$S (f = _+$S) => return 0$S changed: - (f = _*) => return 1$S (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(coerceMap2E(f)$Lisp,coerceMap2E(g)$Lisp)$Lisp -- myred(f:(S,S)->S, x:List S):S == if empty? x then if S has AbelianMonoid then (f = _+$S) => return 0$S if S has Monoid then (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/8345211384216208305-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 Time: 0 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.08 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) theMap(INT;+;3$;37,724) theMap(newGoGet) theMap(INT;+;3$;37,724) theMap(newGoGet) >> Error detected within library code: reducing over an empty list needs the 3 argument form