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

Edit detail for SandBoxMyReduce revision 3 of 14

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

changed:
-   import MyReduce1(S)
   -- Waldek's local helper function
   getfun(f:(S,S)->S):(S,S)-> S == f
   --

removed:
-     getfun(f:(S,S)->S):(S,S)-> S == f

spad
)abbrev package MYRED MyReduce MyReduce(S:Type): with reduce: ((S,S)->S,List S) -> S == add -- Waldek's local helper function getfun(f:(S,S)->S):(S,S)-> S == f -- reduce(f:(S,S)->S, x:List S):S == if empty? x then if S has AbelianMonoid then f=getfun(_+$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/774057614051888942-25px001.spad using 
      old system compiler.
   MYRED abbreviates package MyReduce 
------------------------------------------------------------------------
   initializing NRLIB MYRED for MyReduce 
   compiling into NRLIB MYRED 
****** comp fails at level 1 with expression: ******
((DEF (|getfun| |f|) ((|Mapping| S S S) (|Mapping| S S S)) (NIL NIL)
      |f|))
****** level 1  ******
$x:= (DEF (getfun f) ((Mapping S S S) (Mapping S S S)) (NIL NIL) f)
$m:= $EmptyMode
$f:=
((((|$Information| #) (|$DomainsInScope| # . #1=(# #)) (|reduce| # #)
   (|$DomainsInScope| # . #1#) ...)))
   >> Apparent user error:
   Wrong number of arguments: 
   (getfun f)