6.001 Structure and Interpretation of Computer Programs. Copyright o 2004 by Massachusetts Institute of Technology Slide 13.2.9 Now all we have to do is check that the contract holds for thisExample: What is our"pair"object? data abstraction. In doing so, we will see how this structure of a (cons 1 2)) procedure with access to local state captures exactly the becomes(f∞tCR) behavior we want To check this, lets evaluate(car foo). We know that this"as should get converted into (foo car), so how does this happen? 6001 sICP Example: What is our"pair"object? Slide 13.2.10 aluating(car foo) in the globa ( Define foo(cons12)】 (car fod) becomes (foo 1CRR) applies the procedure that is the value associated with car to the value of foo which is the procedure object shown. Now he definition of car shows that this reduces to evaluating the body of car namely (foo 'car)with respect to some po new environment Slide 13.2.1 Example: What is our "pair object? and what does that do? It says to apply the value associated with foo, which is a procedure, so the standard environment (cons 1 2)) model says to drop a frame, and scope it by the environment ar foo) becomes (foo .CAR) pointer of foo. This is important as E3 now points to E1 Inside e3 we bind the parameter ms g to the argument car Relative to this frame we evaluate the body of the procedure epresented by foo. but that is just a cond clause that looks at the value of ms g and compares it to a set of symbols. In this case, the cond says to return the value of x with respect to 60015e this frame, which is just 1. This is exactly what I wanted, as it shows that my contract is satisfied6.001 Structure and Interpretation of Computer Programs. Copyright © 2004 by Massachusetts Institute of Technology. Slide 13.2.9 Now all we have to do is check that the contract holds for this data abstraction. In doing so, we will see how this structure of a procedure with access to local state captures exactly the behavior we want. To check this, lets evaluate (car foo). We know that this should get converted into (foo 'car), so how does this happen? Slide 13.2.10 Evaluating (car foo) in the global environment simply applies the procedure that is the value associated with car to the value of foo which is the procedure object shown. Now the definition of car shows that this reduces to evaluating the body of car namely (foo 'car) with respect to some new environment. Slide 13.2.11 ... and what does that do? It says to apply the value associated with foo, which is a procedure, so the standard environment model says to drop a frame, and scope it by the environment pointer of foo. This is important as E3 now points to E1. Inside E3 we bind the parameter msg to the argument car. Relative to this frame we evaluate the body of the procedure represented by foo. But that is just a cond clause that looks at the value of msg and compares it to a set of symbols. In this case, the cond says to return the value of x with respect to this frame, which is just 1. This is exactly what I wanted, as it shows that my contract is satisfied