# Difference between revisions of "Math.Arithmetic.Addition"

m (→Edition) |
m (→Edition) |
||

Line 98: | Line 98: | ||

| [[File:AdditionBefore.png]] Addition (before) || [[File:Addition8.png]] | | [[File:AdditionBefore.png]] Addition (before) || [[File:Addition8.png]] | ||

|- | |- | ||

− | | [[File:AdditionStrict.png]] Addition (forced) || | + | | [[File:AdditionStrict.png]] Addition (forced) || [[File:Addition17.png]] |

|- | |- | ||

− | | [[File:AdditionBeforeStrict.png]] Addition (forced, before) || | + | | [[File:AdditionBeforeStrict.png]] Addition (forced, before) || [[File:Addition18.png]] |

|- | |- | ||

| [[File:Minus.png]] Subtraction || | | [[File:Minus.png]] Subtraction || |

## Revision as of 10:44, 20 April 2016

It is the tag for the expression representing the mathematical addition.

## Contents

# Definition

It is the tag for the expression representing the mathematical addition.

Notice that the string concatenation uses other tag, this is String.Text.Concatenation

Notice that there is no subtraction expression. A subtraction is an addition operation where the sustraend is a negative expression, it is

## Behavior

This expression must have at least two children.

### Children names

The subexpressions should be named "Addend 1", "Addend 2", ... Notice that the first addends is 1 and it is not 0, which happens in some mathematical or computer science contexts.

## Visualization

There could be different visualizations, being the most popular the infix one, that us, using the (+) symbol between each consecutive pair of addends

Other form of visualization could exist, like the prefix form and rarely the postfix form.

## Edition

There could be several editions. The most obvious is: Given a selected expression, it is replaced by a new addition expression with two children, the first one is the expressions that was selected, and the second one is a new Null expression. The latter becomes the new selected expression.

## Reduction

Ther could be several reductions, see below.

# Known implementations

## The Standard Arithmetic Package

### Visualization

There is one visualization on this package. It is a infix one.

It aligns the horizontal baselines of the addends, and the vertical baseline is located in the middle of the width of the expression. See the following example:

#### Negative addends

If an addend is a Math.Arithmetic.Negative expression, and it is not the first child, the minus sign (-) is drawn instead or the plus (+) one. The visualization of the Math.Arithmetic.Negative expression is not invoked, but its child's visualization is instead invoked, this is, the visualization of the unique child of the Math.Arithmetic.Negative expression. In the following example the middle addend is a Math.Arithmetic.Negative expression. The minus sign (-) was drawn by the **Math.Arithmetic.Addition** expression not the Math.Arithmetic.Negative one.

#### Parentheses awareness

This visualization awares whether some of its children belong to the parentheses category Parentheses as operator. In such that case, these children are drawn between parentheses.

In the following example, the second addend is also an addition. Because this expression also belongs to the parentheses category Parentheses as operator (see below), the parent addition shows its children addition between parentheses.

#### Parentheses categories

This visualization belongs to the category Parentheses as operator. It means that if this visualization is a child of a parent visualization that awares of this, that such parent expression will show this child between parentheses.

In the following example, the Math.Arithmetic.Negative visualization awares of its unique child to belong of that category, to show it between parentheses:

This visualization belongs to the category Parentheses as super/subscripted. It means that if this visualization is a child of a parent visualization that awares of this, that such parent expression will show this child between parentheses.

In the following example, the Math.Arithmetic.Exponentiation visualization awares of either its base or exponent to belong of that category, to show either the base or the exponente between parentheses (in this case is the base):