Quantcast

A community for students. Sign up today!

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

ajiwo

  • 2 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
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    (+ 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
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    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
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    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
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

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

  5. dbastos
    • 5 months ago
    Best Response
    You've already chosen the best response.
    Medals 0

    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.

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

    • Attachments:

Ask your own question

Ask a Question
Find more explanations on OpenStudy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.