blob: 85453e72b5a94c2fce3989d86e09656fc29b0fe8 (
plain) (
tree)
|
|
<HTML>
<HEAD>
<TITLE>Simply Scheme part V introduction</TITLE>
</HEAD>
<BODY>
<CITE>Simply Scheme</CITE> 2/e Copyright (C) 1999 MIT
<H1>Abstraction</H1>
<TABLE><TR><TD>
<P><IMG SRC="simply.jpg" ALT="cover photo">
<TD valign="center">
<CITE><A HREF="http://www.cs.berkeley.edu/~bh/">Brian
Harvey</A><BR><A HREF="http://www.cnmat.berkeley.edu/~matt">Matthew
Wright</A><BR>University of California, Berkeley</CITE>
<BR><BR><A HREF="http://www-mitpress.mit.edu/book-home.tcl?isbn=0262082810">MIT
Press web page for Simply Scheme</A>
</TABLE>
<P><A HREF="simply-toc.html">(back to Table of Contents)</A>
<HR>
<P>We've really been talking about abstraction all along. Whenever you find
yourself performing several similar computations, such as
<PRE>
> (sentence 'she (word 'run 's))
(SHE RUNS)
> (sentence 'she (word 'walk 's))
(SHE WALKS)
> (sentence 'she (word 'program 's))
(SHE PROGRAMS)
</PRE>
and you capture the similarity in a procedure
<PRE>
(define (third-person verb)
(sentence 'she (word verb 's)))
</PRE>
<P>you're <EM>abstracting</EM> the pattern of the computation by
expressing it in a form that leaves out the particular verb in any one
instance.
<P>In the preface we said that our approach to computer science is to teach you
to think in larger chunks, so that you can fit larger problems in your mind
at once; "abstraction" is the technical name for that chunking process.
<P>In this part of the book we take a closer look at two specific kinds of
abstraction. One is <EM>data abstraction,</EM> which means the invention of
new data types. The other is the implementation of <EM>higher-order
functions,</EM> an important category of the same process abstraction of which
<CODE>third-person</CODE> is a trivial example.
<P>Until now we've used words and sentences as though they were part of the
natural order of things. Now we'll discover that Scheme sentences exist
only in our minds and take shape through the use of constructors and
selectors (<CODE>sentence</CODE>, <CODE>first</CODE>, and so on) that we wrote. The
implementation of sentences is based on a more fundamental data type called
<EM>lists.</EM> Then we'll see how lists can be used to invent another
in-our-minds data type, <EM>trees.</EM> (The technical term for an invented
data type is an <EM>abstract</EM> data type.)
<P>You already know how higher-order functions can express many computational
processes in a very compact form. Now we focus our attention on the
higher-order <EM>procedures</EM> that implement those functions, exploring
the mechanics by which we create these process abstractions.
<P><A HREF="simply-toc.html">(back to Table of Contents)</A>
</BODY>
</HTML>
|