axiom-math
[Top][All Lists]

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

 From: Ralf Hemmecke Subject: Re: [Axiom-math] What is the "+/" operator? Date: Thu, 24 May 2007 02:27:34 +0200 User-agent: Thunderbird 2.0.0.0 (X11/20070326)

```On 05/24/2007 01:23 AM, Gabriel Dos Reis wrote:
```
```Ralf Hemmecke <address@hidden> writes:

| On 05/23/2007 06:50 PM, Bill Page wrote:
| > Quoting Martin Rubey <address@hidden>:
| >
| >> ... Igor Khavkine writes:
| >>
| >>> Can someone explain this syntax? Looking at the Axiom .spad files,
| >>> I see that it has general usage +/[...some list construction...].
| >>
| >> It is old syntax for reduce and should go away.
```
| | I very much agree. The reason is that one should give an initial value
```| otherwise you might be surprised.

I don't see why there should be a surprise.

Reduction through "/" is a functional on monoid operations, so one
should expect to give a unit element.
```
```
```
Sure. So whoever (which means a program) deals with "/" should first check whether the second argument is a List over a monoid and that the first argument is exactly *the* corresponding binary operation of that particular monoid.
```
```
If I look at it that way, then "/" should be a unary operation since what one currently writes as its first argument in
```
(+)/[1,2,3]

```
is redundant information. The monoid is specified by the argument of List. (The problem arises if a set has two (or more) monoid structures implemented, like Integer.)
```
```
Or are you saying that you have a domain (like Integer) and the first argument then selects the monoid structure? What if I give a binary function as the first argument which doesn't make the underlying set into a monoid? That error cannot even be caught at runtime.
```
```
I am talking here about the compiler. If you have different plans with the interpreter, I don't care at the moment, but for the compiler I see no point why this form of "/" should be build into the (SPAD) language.
```
```
```reduce on the other hand would want an initial value, or a value to
return when the list of operand is empty.
```
```
At least we agree on this.

Ralf

```