正在加载图片...
6.001 Structure and Interpretation of Computer Programs. Copyright o 2004 by Massachusetts Institute of Technology 6.001 Notes: Section 5.1 Slide 5.1.1 In this lecture we are going to continue with the theme of building abstractions. Thus far, we have focused entirely on Procedural procedural abstractions the idea of capturing a common pattern of computation within a procedure, and isolating the details of Relationship between data abstraction and procedures that that computation from the use of the concept within some other Isolating use of data abstraction from details of computation. Today we are going to turn to a complementary issue, namely how to group together pieces of information,or data, into abstract structures. We will see that the same general theme holds: we can isolate the details of how the data are glued together from the use of the aggregate data structure as a 6001 SICP primitive element in some computation. We will also see that the procedures we use to manipulate the elements of a data structure often have an inherent structure that mimics the data structure, and we will use this idea to help us design our data abstractions and their associated procedures Slide 5.1.2 Define fomal praers, caue rces in body o procedure in particular, the idea of procedural abstraction to capture ss Let's review what we have been looking at so far in the col Process of procedural abstract Hde implementation detal fom user, who us invokes name to computations. Our idea is to take a common pattern of computation, then capture that pattern by formalizing it with a set of parameters that specify the parts of the pattern that change, while preserving the pattern inside the body of a procedure. This encapsulates the computation associated with the pattern inside a lambda object. Once we have abstracted that computation inside the lambda, we can then give it a name DOI SICP using our define expression, then treat the whole thing as a primitive by just referring to the name, and use it without worry ing about the details within the lambda Slide 5.1.3 This means we can treat the procedure as it if is a kind of black Hide implementation de om user, who just invokes name to procedure OL SCP6.001 Structure and Interpretation of Computer Programs. Copyright © 2004 by Massachusetts Institute of Technology. 6.001 Notes: Section 5.1 Slide 5.1.1 In this lecture we are going to continue with the theme of building abstractions. Thus far, we have focused entirely on procedural abstractions: the idea of capturing a common pattern of computation within a procedure, and isolating the details of that computation from the use of the concept within some other computation. Today we are going to turn to a complementary issue, namely how to group together pieces of information, or data, into abstract structures. We will see that the same general theme holds: we can isolate the details of how the data are glued together from the use of the aggregate data structure as a primitive element in some computation. We will also see that the procedures we use to manipulate the elements of a data structure often have an inherent structure that mimics the data structure, and we will use this idea to help us design our data abstractions and their associated procedures. Slide 5.1.2 Let's review what we have been looking at so far in the course, in particular, the idea of procedural abstraction to capture computations. Our idea is to take a common pattern of computation, then capture that pattern by formalizing it with a set of parameters that specify the parts of the pattern that change, while preserving the pattern inside the body of a procedure. This encapsulates the computation associated with the pattern inside a lambda object. Once we have abstracted that computation inside the lambda, we can then give it a name, using our define expression, then treat the whole thing as a primitive by just referring to the name, and use it without worrying about the details within the lambda. Slide 5.1.3 This means we can treat the procedure as it if is a kind of black box
向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有