Order of Operations

× | ÷ |

+ | − |

Another way to show order of operations uses circles.

−

4

2

4 − 2

- Each circle must have one function, which goes at the top.
- The numbers are written below the function, in order from left to right.

×

8

3

8 × 3

×

7

−

4

1

7 × (4 − 1)

×

+

6

9

−

4

1

(6 + 9) × (4 − 1)

−

4

2

(− 4 2)

- Any value is a legal expression.
- Each open parenthesis is followed by one function, then by one or more legal expressions, and finally by a closing parenthesis.

×

8

3

(× 8 3)

×

7

−

4

1

(× 7 (− 4 1))

×

+

6

9

−

4

1

(× (+ 6 9) (− 4 1))

- Each function has an opening and closing parenthesis.
- Each function has a
name . - All the expressions that follow the function name are called
arguments to the function.

Example:

For the expression (+ 4 3), the

- Draw a circle of evaluation for the math expression.
- Write the legal expression for the circle of evaluation.

Example:

Given the math expression 17 + (4 − 3)

The circle of evaluation is:

+

17

−

4

3

The legal expression is: (+ 17 (− 4 3))

infix | 4 + 2 | Used in math class |

prefix | + 4 2 | Used in Scheme |

postfix | 4 2 + | Used in other programming |

Computer Programming Unit 1.4 - How to Construct Legal Statements in the Scheme Programming Language