axiom-developer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Axiom-developer] How to do generic sum using aldor?


From: Franz Lehner
Subject: [Axiom-developer] How to do generic sum using aldor?
Date: Wed, 3 Jan 2007 23:17:42 +0100 (CET)

Hello

what is wrong with the following code:

----------------------------------------------------------------
#include "axiom"

extend List (R:Ring) :  with {
          sumlist:(ll: %)->R;
} == {add {
                sumlist ( ll: %) : R == {
                        s: R :=0;
                        for x:R in generator ll repeat  s:= s+x;
                        return s
                }
        }
}
----------------------------------------------------------------

it compiles fine, but then I get

(1) -> sumlist [1,2,3]
 1) ->
   >> System error:
   Caught fatal error [memory may be damaged]

this happens on debian stable, Axiom+Aldor from April 2006,
(axiom-aldor-20060621.tgz as available on axiom-developer.org).
I was wondering how to implement a "generic" sumlist function.

thanks
Franz




reply via email to

[Prev in Thread] Current Thread [Next in Thread]