anonymous
  • anonymous
=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?
MIT 6.001 Structure and Interpretation of Computer Programs, Spring 2005
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
jamiebookeater
  • jamiebookeater
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
anonymous
  • anonymous
(+ 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
anonymous
  • anonymous
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.
anonymous
  • anonymous
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.

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

anonymous
  • anonymous
yes, from my example problem: (+ 1 2 3) is combination. and from jagan example answer: (+ (* 1 2) 3) is also combination.
anonymous
  • anonymous
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.

Looking for something else?

Not the answer you are looking for? Search for more explanations.