Page 1

Symbolic Expressions

Page 2

Reflections on last week's lecture

We wrote a parser for arithmetic expressions

Page 3

Arithmetic Expressions

Remember this from last week?

Page 4

Symbolic Expressions

How about expressions with variables in them?

data Expr = Num Integer
          | Var Name       -- new
          | Add Expr Expr
          | Mul Expr Expr

type Name = String
Page 5

Gathering variables

Page 6

Evaluating Symbolic Expressions

Page 7

The Maybe type

Page 8

Symbolic Differentiation

Page 9
Symbolic Differentiation
Page 10

Smart constructors

Page 11

Simplifying expressions

Page 12

Extending our simple calculator

Adding definitions

Page 13
Extending our simple calculator

A read-eval-print loop with definitions

Page 14
Extending our simple calculator

Improving the simple calculator