You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
613 B
16 lines
613 B
2 years ago
|
|
||
|
Exercise 3.8: When we defined the evaluation
|
||
|
model in 1.1.3, we said that the first step in evaluating an
|
||
|
expression is to evaluate its subexpressions. But we never specified the order
|
||
|
in which the subexpressions should be evaluated (e.g., left to right or right
|
||
|
to left). When we introduce assignment, the order in which the arguments to a
|
||
|
procedure are evaluated can make a difference to the result. Define a simple
|
||
|
procedure f such that evaluating
|
||
|
|
||
|
|
||
|
(+ (f 0) (f 1))
|
||
|
|
||
|
will return 0 if
|
||
|
the arguments to + are evaluated from left to right but will return 1 if
|
||
|
the arguments are evaluated from right to left.
|