login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Edit detail for SandBoxMyReduce revision 4 of 14

1 2 3 4 5 6 7 8 9 10 11 12 13 14
Editor: Bill Page
Time: 2008/04/07 14:50:17 GMT-7
Note: Waldek's function

changed:
-    reduce: ((S,S)->S,List S) -> S
    myred: ((S,S)->S,List S) -> S

changed:
-   getfun(f:(S,S)->S):(S,S)-> S == f
   F ==> (S,S)->S
   eqfun(f:F,g:F):Boolean == EQ(g,f)$Lisp

changed:
-   reduce(f:(S,S)->S, x:List S):S ==
   myred(f:(S,S)->S, x:List S):S ==

changed:
-         f=getfun(_+$S) => 0$S
         eqfun(f,_+$S) => 0$S

added:

\begin{axiom}
myred(+,[1,2,3])
\end{axiom}

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 eqfun(f:F,g:F):Boolean == EQ(g,f)$Lisp -- myred(f:(S,S)->S, x:List S):S == if empty? x then if S has AbelianMonoid then eqfun(f,_+$S) => 0$S error "reducing over an empty list needs the 3 argument form" reduce(f, rest x, first x)
spad
   Compiling OpenAxiom source code from file 
      /var/zope2/var/LatexWiki/1041302983496947867-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 eqfun : ((S,S) -> S,(S,S) -> S) -> Boolean
      MYRED;eqfun is replaced by EQgf 
Time: 0.01 SEC.
   compiling exported myred : ((S,S) -> S,List S) -> S
****** Domain: S already in scope
augmenting S: (AbelianMonoid)
Time: 0.10 SEC.
(time taken in buildFunctor:  0)
;;;     ***       |MyReduce| REDEFINED
;;;     ***       |MyReduce| REDEFINED
Time: 0 SEC.
   Cumulative Statistics for Constructor MyReduce
      Time: 0.11 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

axiom
myred(+,[1,2,3])
LatexWiki Image(1)
Type: PositiveInteger?