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

Edit detail for SandBoxMyReduce revision 1 of 14

1 2 3 4 5 6 7 8 9 10 11 12 13 14
Editor: Bill Page
Time: 2008/04/03 00:36:04 GMT-7
Note: new

changed:
-
\begin{spad}
)abbrev package MYRED1 MyReduce1
MyReduce1(S:AbelianMonoid): with
    plus: (S,S)->S
 == add
    plus(a,b) == a + b

)abbrev package MYRED MyReduce
MyReduce(S:Type): with
    reduce: ((S,S)->S,List S) -> S
 == add
   import MyReduce1(S)
   reduce(f:(S,S)->S, x:List S):S ==
     if empty? x then
       if S has AbelianMonoid then
         f=plus(#1,#2) => 0$S
       error "reducing over an empty list needs the 3 argument form"
     reduce(f, rest x, first x)
\end{spad}

spad
)abbrev package MYRED1 MyReduce1 MyReduce1(S:AbelianMonoid): with plus: (S,S)->S == add plus(a,b) == a + b )abbrev package MYRED MyReduce MyReduce(S:Type): with reduce: ((S,S)->S,List S) -> S == add import MyReduce1(S) reduce(f:(S,S)->S, x:List S):S == if empty? x then if S has AbelianMonoid then f=plus(#1,#2) => 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/5449461755432456092-25px001.spad using 
      old system compiler.
   MYRED1 abbreviates package MyReduce1 
------------------------------------------------------------------------
   initializing NRLIB MYRED1 for MyReduce1 
   compiling into NRLIB MYRED1 
   compiling exported plus : (S,S) -> S
Time: 0 SEC.
(time taken in buildFunctor:  0)
;;;     ***       |MyReduce1| REDEFINED
;;;     ***       |MyReduce1| REDEFINED
Time: 0 SEC.
   Cumulative Statistics for Constructor MyReduce1
      Time: 0 seconds
   finalizing NRLIB MYRED1 
   Processing MyReduce1 for Browser database:
--->-->MyReduce1((plus (S S S))): Not documented!!!!
--->-->MyReduce1(constructor): Not documented!!!!
--->-->MyReduce1(): Missing Description
------------------------------------------------------------------------
   MyReduce1 is now explicitly exposed in frame initial 
   MyReduce1 will be automatically loaded when needed from 
      /var/zope2/var/LatexWiki/MYRED1.NRLIB/code
   MYRED abbreviates package MyReduce 
------------------------------------------------------------------------
   initializing NRLIB MYRED for MyReduce 
   compiling into NRLIB MYRED 
   importing MyReduce1 S
   compiling exported reduce : ((S,S) -> S,List S) -> S
****** Domain: S already in scope
augmenting S: (AbelianMonoid)
****** Domain: S already in scope
augmenting S: (AbelianMonoid)
****** comp fails at level 11 with expression: ******
error in function reduce 
(SEQ (SEQ (LET #0=#:G1402 (|empty?| |x|))
          (|exit| 1
                  (IF #0#
                      (SEQ (IF (|has| S (|AbelianMonoid|))
                               (SEQ (LET #1=#:G1401
                                      (= |f|
                                       (|plus| | << #1 >> | |#2|)))
                                    (|exit| 1
                                     (IF #1# (|exit| 2 (|elt| S 0))
                                      |%noBranch|)))
                               |%noBranch|)
                           (|exit| 1
                                   (|error|
                                    "reducing over an empty list needs the 3 argument form")))
                      |%noBranch|)))
     (|exit| 1 (|reduce| |f| (|rest| |x|) (|first| |x|))))
****** level 11  ******
$x:= #1
$m:= $EmptyMode
$f:=
((((S # . #2=(#)) (|$Information| #) (#:G1402 #) (|x| # . #6=(#)) ...)))
   >> Apparent user error:
   no mode found for
   #1