In SICP part 1.1.5 The Substitution Model for Procedure Application I am curious about the applicative order of evaluation.
I understand that applicative order evaluates the arguments before applying the outer procedure.
My question is what order does it go through the arguments?
For example,
(+ (+ 2 1) (/ 10 2))
Will (+ 2 1)
or (/ 10 2)
get evalutated first?
I assume that you are still on chapter 1 of the book. Rest assured that the rest of the book will explain this to you in greater detail. For now, you may be interested in this footnote from section 3.2.1 The Rules for Evaluation:
... this order [left to right or right to left] should always be considered to be an implementation detail, and one should never write programs that depend on some particular order. For instance, a sophisticated compiler might optimize a program by varying the order in which subexpressions are evaluated.
Later chapters discuss this question is increasing detail. For example:
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"