[Top][All Lists]

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

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

From: Gernot Hueber
Subject: Re: [Axiom-developer] How to do generic sum using aldor?
Date: Thu, 04 Jan 2007 08:34:55 +0100

You also can use reduce. E.g. reduce(+, [1,2,3]) Gernot Ralf Hemmecke writes:
You should have read previous posts. Axiom does not understand "extend". The following code does what you want. Just say
sumlist [1,2,3]
#include "axiom"
SumPackage(R: Ring): with {
    sumlist: List R -> R;
} == add {
     sumlist (l: List R): R == {
         s: R := 0;
         for x in l repeat  s:= s+x;
         return s
Have fun

Axiom-developer mailing list

reply via email to

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