[Top][All Lists]

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

Re: [Axiom-math] What is the "+/" operator?

From: Gabriel Dos Reis
Subject: Re: [Axiom-math] What is the "+/" operator?
Date: Wed, 23 May 2007 20:07:10 -0500 (CDT)

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. 


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

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

-- Gaby

reply via email to

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