blob: de18e463b98da598d067a34cddeb22e9fc47fed3 (
plain) (
tree)
|
|
<P>
<P>
<HTML>
<HEAD>
<TITLE>Simply Scheme: Introducing Computer Science, Part 17: Abstraction</TITLE>
</HEAD>
<BODY>
<CITE>Simply Scheme:</CITE>
<CITE>Introducing Computer Science</CITE> 2/e Copyright (C) 1999 MIT
<H2>Part V</H2>
<H1>Abstraction</H1>
<TABLE width="100%"><TR><TD>
<IMG SRC="../simply.jpg" ALT="cover photo">
<TD><TABLE>
<TR><TD align="right"><CITE><A HREF="http://www.cs.berkeley.edu/~bh/">Brian
Harvey</A><BR>University of California, Berkeley</CITE>
<TR><TD align="right"><CITE><A HREF="http://ccrma.stanford.edu/~matt">Matthew
Wright</A><BR>University of California, Santa Barbara</CITE>
<TR><TD align="right"><BR>
<TR><TD align="right"><A HREF="../pdf/ssch17.pdf">Download PDF version</A>
<TR><TD align="right"><A HREF="../ss-toc2.html">Back to Table of Contents</A>
<TR><TD align="right"><A HREF="../ssch16/match.html"><STRONG>BACK</STRONG></A>
chapter thread <A HREF="lists.html"><STRONG>NEXT</STRONG></A>
<TR><TD align="right"><A HREF="http://mitpress.mit.edu/0262082810">MIT
Press web page for <CITE>Simply Scheme</CITE></A>
</TABLE></TABLE>
<HR><BIG>
<P>We've really been talking about abstraction all along. Whenever you find
yourself performing several similar computations, such as
<P><PRE>> (sentence 'she (word 'run 's))
(SHE RUNS)
> (sentence 'she (word 'walk 's))
(SHE WALKS)
> (sentence 'she (word 'program 's))
(SHE PROGRAMS)
</PRE>
<P>and you capture the similarity in a procedure
<P><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>
</BIG>
<HR>
<P><A HREF="../ss-toc2.html">(back to Table of Contents)</A><P>
<A HREF="../ssch16/match.html"><STRONG>BACK</STRONG></A>
chapter thread <A HREF="lists.html"><STRONG>NEXT</STRONG></A>
<P>
<ADDRESS>
<A HREF="../index.html">Brian Harvey</A>,
<CODE>bh@cs.berkeley.edu</CODE>
</ADDRESS>
</BODY>
</HTML>
|