[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: |
Ralf Hemmecke |
Subject: |
Re: [Axiom-developer] How to do generic sum using aldor? |
Date: |
Wed, 03 Jan 2007 23:39:50 +0100 |
User-agent: |
Thunderbird 1.5.0.9 (X11/20061206) |
You should have read previous posts. Axiom does not understand "extend".
The following code does what you want. Just say
%axiom
)co sumlist.as
sumlist [1,2,3]
---BEGIN sumlist.as
#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
}
}
---END sumlist.as
Have fun
Ralf