Repository navigation
We keep developing our pocket calculator to make it support any integer arithmetic expression.
Our arithmetic language lets us work with integer arithmetic expressions---a.k.a. arithmetic without fractions. Expressions involve sums, subtractions, products, and divisions among integer values. Since we're only dealing with integers, the result of evaluating an expression should still be an integer. For this reason, x/y is an integer division which returns the quotient q of Euclidean division of x by y---i.e. x = y*q + r, 0 <= r < |y|.
Notice how extending the Expr data type with more cases in the Lang module caused a ripple effect in all the others. This is an instance of the "expression problem" which is a bit too hard to solve with what we know at this stage. But we'll revisit this problem again in a few months from now and put in place a mind-bending solution :-)