On Wed, 23 May 2007, Bill Page wrote:
| (4) -> (+)/[1,2,3]
| Compiling function / with type (((Integer,Integer) -> Integer),List
| Integer) -> Integer
|
| Based on this I tentatively withdraw my object. However as you
| point out:
|
| empty? l => 0
|
| is bogus. What we want is something like:
|
| empty? l => Unit(f)
|
| where f(x,Unit f) = x.
Yes.
That should not come as a surprise to Axiomatizers. Here is why: List T is a
monoid with
(*) append as the monoid operation,
(*) and the empty list being the unit.
Consequently, sum or product, etc. are just *catamorphisms" you would express
naturally through the reduction functional (also known as "fold" in the
functional programming community). There is a good paper that should probably
be linked from Axiom's website:
"Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire"
Erik Meijer, Maarten Fokkinga, and Ross Paterson
http://wwwhome.cs.utwente.nl/~fokkinga/index.html#detail_0000003415
I must admit that where I first realized (four years ago) that Aldor (and
Spad) actually have the tokens "(|", "|)", "[|, "|]", "{|", and "|}",
I thought they were to support that kind of algebraic programming. However,
The Aldor manual just says they are reserved for future use without saying
much.
-- Gaby
_______________________________________________
Axiom-math mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/axiom-math