# Assignment: Functional programming (4 points+1 bonus mark)

## Due date: October 9, 11:59pm

You can seek help from our graduate assistant Fen Zhao. Her email is zhao15m at uwindsor. She can be reached at ER 3146, from 10:00am-12:00am every Friday.

## Submission

Submit to the Blackboard system using file attachment.

## Assignment specification

You will define a calculator for simple arithmetic expressions in
scheme. For example, when typing (calculator '( 1 + 2)), scheme interpreter will
print 3. The calculator will accept expression of any length, and the expression
associates to the right. For example, in (calculator '(1 + 1 - 2 + 3 ))
the expression is interpreted as (1+ (1 -(2+3))), hence the value is -3.

You can assume that the expressions have + and - operators only. In addition,
there are no brackets in expressions.

The syntax for the expression is

exp ::= number | exp op exp
op ::= + | - | * | /

Note that the arithmetc expression supports four operators.

## Marking

We will test your program using kawa, since different implmentations may behave differently. In particular, please notice that DrRacket supports different versions of the language. You may use LazyRacket.

If you evaluate the expression using left associativity, you will be awarded with one bonus mark. For example, the above example should be interpreted as (1 + 1 - 2 + 3) should be interpreted as ( ((1 + 1 ) -2) + 3), therefore the result is 3. In your submission please indicate whether it is left associative or right associative.
You only need to submit one version of your program, i.e., either left associative or right associative.

You can assume that the input is a correct arithmatic expression. We will not test cases like

(calculator '(1 + ))

or

(calculator '(- 1 + 2))