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

Edit detail for SandBoxMyReduce revision 5 of 14

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

added:
myred(_$+Integer,[]::List Integer)

\begin{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)
\end{spad}

\begin{axiom} myred(+,[1,2,3]) myred(_$+Integer,[]::List Integer) \end{axiom}


Some or all expressions may not have rendered properly, because Axiom returned the following error:
Error: export AXIOM=/usr/local/lib/open-axiom/x86_64-unknown-linux/1.1.0-2008-01-28; export ALDORROOT=/usr/local/aldor/linux/1.1.0; export PATH=$ALDORROOT/bin:$PATH; export HOME=/var/zope2/var/LatexWiki; ulimit -t 240; export LD_LIBRARY_PATH=/usr/local/lib/open-axiom/x86_64-unknown-linux/1.1.0-2008-01-28/lib; LANG=en_US.UTF-8 $AXIOM/bin/AXIOMsys < /var/zope2/var/LatexWiki/1240697668389450188-25px.axm
/bin/sh: /usr/local/lib/open-axiom/x86_64-unknown-linux/1.1.0-2008-01-28/bin/AXIOMsys: not found


Some or all expressions may not have rendered properly, because Latex returned the following error:
! Missing $ inserted.
<inserted text> 
                $
l.137 \end{spad}
                \newpage

Overfull \hbox (78.15031pt too wide) in paragraph at lines 123--137 \T1/cmr/m/n/12 ==> (S,S)->S eq-fun(f:F,g:F):Boolean == EQ(g,f)$\OML/cmm/m/it/12 Lisp \OMS/cmsy/m/n/12 ^^@ ^^@\OML/cmm/m/it/12 myred\OT1/cmr/m/n/12 (\OML/cmm/m /it/12 f \OT1/cmr/m/n/12 : (\OML/cmm/m/it/12 S; S\OT1/cmr/m/n/12 )\OMS/cmsy/m/n /12 ^^@ \OML/cmm/m/it/12 > S; x \OT1/cmr/m/n/12 : \OML/cmm/m/it/12 ListS\OT1/cm r/m/n/12 ) : \OML/cmm/m/it/12 S \OT1/cmr/m/n/12 == \OML/cmm/m/it/12 ifempty\OT1 /cmr/m/n/12 ?