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}

fricas
(1) -> <spad>
fricas
)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>
fricas
Compiling FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/1041302983496947867-25px001.spad
      using 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 SEC.
compiling exported myred : ((S,S) -> S,List S) -> S ****** Domain: S already in scope augmenting S: (AbelianMonoid) Time: 0 SEC.
(time taken in buildFunctor: 0) Time: 0 SEC.
Cumulative Statistics for Constructor MyReduce Time: 0 seconds
finalizing NRLIB MYRED Processing MyReduce for Browser database: --->-->MyReduce(constructor): Not documented!!!! --->-->MyReduce((myred (S (Mapping S S S) (List S)))): Not documented!!!! --->-->MyReduce: Missing Description ; compiling file "/var/aw/var/LatexWiki/MYRED.NRLIB/MYRED.lsp" (written 27 OCT 2026 02:12:38 AM):
; wrote /var/aw/var/LatexWiki/MYRED.NRLIB/MYRED.fasl ; compilation finished in 0:00:00.008 ------------------------------------------------------------------------ MyReduce is now explicitly exposed in frame initial MyReduce will be automatically loaded when needed from /var/aw/var/LatexWiki/MYRED.NRLIB/MYRED

fricas
myred(+,[1,2,3])

\label{eq1}6(1)
Type: PositiveInteger?