## ajiwo 3 years ago =quote= To evaluate a combination, do the following: 1. Evaluate the subexpressions of the combination. 2. Apply the procedure that is the value of the leftmost subexpression (the operator) to the arguments that are the values of the other subexpressions (the operands). =question= can someone please explain how to apply this combination (+ 1 2 3) according to the above rule?

• This Question is Open
1. jagan

(+ 1 2 3) is primitive expression, which will be evaluated as 1+2+3. But to evaluate a combination(nested expression) this rule will apply. Like (+ (*1 2) 3). 1) first evaluate the sub expression (* 1 2 ) 2) (+ 2 3) - primitive expression.solved directly ans 5

2. ajiwo

thanks @jagan but according to =quote= 1.1.1 Expression ... One kind of primitive expression you might type is a number. ... Expressions representing numbers may be combined with an expression representing a primitive procedure (such as + or *) to form a compound expression that represents the application of the procedure to those numbers. For example: (+ 137 349) ... Expressions such as these, formed by delimiting a list of expressions within parentheses in order to denote procedure application, are called combinations. =reply= so i think (+ 1 2 3) is a combination. because each of the + 1 2 3 is the primitive expression. The ( and ) is the means of combination.

3. jolisper

Hi @ajiwo, I read again 1.1.1 Expressions section and I think that (+ 1 2 3) is a combination just because it is a list of expressions within parentheses, that is to say that is not necessary that the list of expressions were formed only by primitives expressions to be a combination. Non-primitive expressions within parentheses also form combinations.

4. ajiwo

yes, from my example problem: (+ 1 2 3) is combination. and from jagan example answer: (+ (* 1 2) 3) is also combination.

5. dbastos

It looks like you're still left with the problem of how to apply the rules above to /evaluate/ the combination. Is that correct? Here's my take on it. The first element of the combination is a procedure. A procedure is a primitive. The other elements are numbers, all primitive. Therefore, all subexpressions were evaluated --- and we used only the rule number 1. We're left now with a combination of only primitive things. Now we use rule 2. We invoke the procedure passing to it all the other arguments. For completeness, let's invent another rule which allows us to substitute a combination with another combination or with a primitive. Since the procedure is + and the arguments are 1 2 3, then the whole combination should equal the primitive value 6. Applying our new invented rule, we can replace the whole combination with the primitive value 6. Perhaps you'll appreciate this approach.