Title: Create an expression tree from:
1Create an expression tree from
2Create an expression tree from
Consider, what gets evaluated first?
3Create an expression tree from
Consider, what gets evaluated first?
4Create an expression tree from
How can we write this sum as an expression tree?
5Create an expression tree from
How can we write this sum as an expression tree?
6Create an expression tree from
What gets evaluated next?
7Create an expression tree from
What gets evaluated next?
8Create an expression tree from
Now what?
9Create an expression tree from
Now what?
10Create an expression tree from
Now what?
11Create an expression tree from
Now what?
12Create an expression tree from
And now?
13Create an expression tree from
And now?
14Now translate this tree into functional notation.
15sum()
16sum(difference(), 4)
17sum(difference(9, quotient()), 4)
18sum(difference(9, quotient(product(), 15)), 4)
19sum(difference(9, quotient(product(6, sum()),
15)), 4)
20sum(difference(9, quotient(product(6, sum(2, 3)),
15)), 4)
21sum(difference(9, quotient(product(6, sum(2, 3)),
15)), 4)
22sum(difference(9, quotient(product(6, sum(2, 3)),
15)), 4)
Scheme implementation
( (- 9 (/ ( 6 ( 2 3)) 15)) 4)