about summary refs log tree commit diff stats
path: root/js/games/nluqo.github.io/~bh/simply-toc.html
blob: f8af9e9569b5c85502eaadd3d31659cffe3da696 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
<HTML>
<HEAD>
<TITLE>Simply Scheme contents</TITLE>
<link rel="shortcut icon" href="http://www.cs.berkeley.edu/~bh/simply.png" type="image/png">
</HEAD>
<BODY>
<H1><CITE>Simply Scheme:<BR>Introducing Computer Science</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 <CITE>Simply Scheme</CITE></A>
</TABLE>

<P><TABLE><TR><TD><A HREF="ss/foreword.html"><H3>Foreword</H3></A>
<TD>by Hal Abelson</TABLE>

<H3><A HREF="https://people.eecs.berkeley.edu/~bh/ss/preface">Preface</A></H3>
<UL>
<LI>One Big Idea: Symbolic Programming
<LI>Lisp and Radical Computer Science
<LI>Who Should Read This Book
<LI>How to Read This Book
</UL>

<H3><A HREF="ss/instructor.html">To the Instructor</A></H3>
<UL>
<LI>Lists and Sentences
<LI>Sentences and Words
<LI>Overloading in the Text Abstraction
<LI>Higher-Order Procedures, Lambda, and Recursion
<LI>Mutators and Environments
</UL>

<H3><A HREF="ss/ack.html">Acknowledgments</A></H3>

<P><EM>(Note: The links on the Part headings below point to the
introductions to the major parts of the book, each introducing one
"big idea."  Each introduction is about a page of text.)</EM>

<A HREF="part1.html"><H2>Part I. Introduction: Functions</H2></A>

<H3>1. Showing Off Scheme</H3>
<UL>
<LI>Talking to Scheme
<LI>Recovering from Typing Errors
<LI>Exiting Scheme
<LI>More Examples
<LI>Example: Acronyms
<LI>Example: Pig Latin
<LI>Example: Ice Cream Choices
<LI>Example: Combinations from a Set
<LI>Example: Factorial
<LI>Play with the Procedures
</UL>

<H3>2. Functions</H3>
<UL>
<LI>Arithmetic
<LI>Words
<LI>Domain and Range
<LI>More Types: Sentences and Booleans
<LI>Our Favorite Type: Functions
<LI>Play with It
<LI>Thinking about What You've Done
</UL>

<A HREF="part2.html"><H2>Part II. Composition of Functions</H2></A>

<H3>3. Expressions</H3>
<UL>
<LI>Little People
<LI>Result Replacement
<LI>Plumbing Diagrams
<LI>Pitfalls
</UL>

<H3>4. Defining Your Own Procedures</H3>
<UL>
<LI>How to Define a Procedure
<LI>Special Forms
<LI>Functions and Procedures
<LI>Argument Names versus Argument Values
<LI>Procedure as Generalization
<LI>Composability
<LI>The Substitution Model
<LI>Pitfalls
</UL>

<H3>5. Words and Sentences</H3>
<UL>
<LI>Selectors
<LI>Constructors
<LI>First-Class Words and Sentences
<LI>Pitfalls
</UL>

<H3>6. True and False</H3>
<UL>
<LI>Predicates
<LI>Using Predicates
<LI><CODE>If</CODE> Is a Special Form
<LI>So Are <CODE>And</CODE> and <CODE>Or</CODE>
<LI>Everything That Isn't False Is True
<LI>Decisions, Decisions, Decisions
<LI><CODE>If</CODE> Is Composable
<LI>Pitfalls
</UL>

<H3>7. Variables</H3>
<UL>
<LI>How Little People Do Variables
<LI>Global and Local Variables
<LI>The Truth about Substitution
<LI><CODE>Let</CODE>
<LI>Pitfalls
</UL>

<A HREF="part3.html"><H2>Part III. Functions as Data</H2></A>

<H3>8. Higher-Order Functions</H3>
<UL>
<LI><CODE>Every</CODE>
<LI>A Pause for Reflection
<LI><CODE>Keep</CODE>
<LI><CODE>Accumulate</CODE>
<LI>Combining Higher-Order Functions
<LI>Choosing the Right Tool
<LI>First-Class Functions and First-Class Sentences
<LI><CODE>Repeated</CODE>
<LI>Pitfalls
</UL>

<H3>9. Lambda</H3>
<UL>
<LI>Procedures That Return Procedures
<LI>The Truth about <CODE>Define</CODE>
<LI>The Truth about <CODE>Let</CODE>
<LI>Name Conflicts
<LI>Named and Unnamed Functions
<LI>Pitfalls
</UL>

<H3>Project: Scoring Bridge Hands</H3>

<H3>10. Example: Tic-Tac-Toe</H3>
<UL>
<LI>A Warning
<LI>Technical Terms in Tic-Tac-Toe
<LI>Thinking about the Program Structure
<LI>The First Step: Triples
<LI>Finding the Triples
<LI>Using <CODE>Every</CODE> with Two-Argument Procedures
<LI>Can the Computer Win on This Move?
<LI>If So, in Which Square?
<LI>Second Verse, Same as the First
<LI>Now the Strategy Gets Complicated
<LI>Finding the Pivots
<LI>Taking the Offensive
<LI>Leftovers
<LI>Complete Program Listing
</UL>

<A HREF="https://people.eecs.berkeley.edu/~bh/part4.html"><H2>Part IV. Recursion</H2></A>

<H3>11. Introduction to Recursion</H3>
<UL>
<LI>A Separate Procedure for Each Length
<LI>Use What You Have to Get What You Need
<LI>Notice That They're All the Same
<LI>Notice That They're Almost All the Same
<LI>Base Cases and Recursive Calls
<LI>Pig Latin
<LI>Problems for You to Try
<LI>Our Solutions
<LI>Pitfalls
</UL>

<H3>12. The Leap of Faith</H3>
<UL>
<LI>From the Combining Method to the Leap of Faith
<LI>Example: <CODE>Reverse</CODE>
<LI>The Leap of Faith
<LI>The Base Case
<LI>Example: <CODE>Factorial</CODE>
<LI>Likely Guesses for Smaller Subproblems
<LI>Example: <CODE>Downup</CODE>
<LI>Example: <CODE>Evens</CODE>
<LI>Simplifying Base Cases
<LI>Pitfalls
</UL>

<H3>13. How Recursion Works</H3>
<UL>
<LI>Little People and Recursion
<LI>Tracing
<LI>Pitfalls
</UL>

<H3>14. Common Patterns in Recursive Procedures</H3>
<UL>
<LI>The <CODE>Every</CODE> Pattern
<LI>The <CODE>Keep</CODE> Pattern
<LI>The <CODE>Accumulate</CODE> Pattern
<LI>Combining Patterns
<LI>Helper Procedures
<LI>How to Use Recursive Patterns
<LI>Problems That Don't Follow Patterns
<LI>Pitfalls
</UL>

<H3>Project: Spelling Names of Huge Numbers</H3>

<H3>15. Advanced Recursion</H3>
<UL>
<LI>Example: <CODE>Sort</CODE>
<LI>Example: <CODE>From-Binary</CODE>
<LI>Example: <CODE>Mergesort</CODE>
<LI>Example: <CODE>Subsets</CODE>
<LI>Pitfalls
</UL>

<H3>Project: Scoring Poker Hands</H3>
<UL>
<LI>Extra Work for Hotshots
</UL>

<H3>16. Example: Pattern Matcher</H3>
<UL>
<LI>Problem Description
<LI>Implementation: When Are Two Sentences Equal?
<LI>When Are Two Sentences Nearly Equal?
<LI>Matching with Alternatives
<LI>Backtracking
<LI>Matching Several Words
<LI>Combining the Placeholders
<LI>Naming the Matched Text
<LI>The Final Version
<LI>Abstract Data Types
<LI>Backtracking and <CODE>Known-Values</CODE>
<LI>How We Wrote It
<LI>Complete Program Listing
</UL>

<A HREF="part5.html"><H2>Part V. Abstraction</H2></A>

<H3>17. Lists</H3>
<UL>
<LI>Selectors and Constructors
<LI>Programming with Lists
<LI>The Truth about Sentences
<LI>Higher-Order Functions
<LI>Other Primitives for Lists
<LI>Association Lists
<LI>Functions That Take Variable Numbers of Arguments
<LI>Recursion on Arbitrary Structured Lists
<LI>Pitfalls
</UL>

<H3>18. Trees</H3>
<UL>
<LI>Example: The World
<LI>How Big Is My Tree?
<LI>Mutual Recursion
<LI>Searching for a Datum in the Tree
<LI>Locating a Datum in the Tree
<LI>Representing Trees as Lists
<LI>Abstract Data Types
<LI>An Advanced Example: Parsing Arithmetic Expressions
<LI>Pitfalls
</UL>

<H3>19. Implementing Higher-Order Functions</H3>
<UL>
<LI>Generalizing Patterns
<LI>The <CODE>Every</CODE> Pattern Revisited
<LI>The Difference between <CODE>Map</CODE> and <CODE>Every</CODE>
<LI><CODE>Filter</CODE>
<LI><CODE>Accumulate</CODE> and <CODE>Reduce</CODE>
<LI>Robustness
<LI>Higher-Order Functions for Structured Lists
<LI>The Zero-Trip Do Loop
<LI>Pitfalls
</UL>

<A HREF="part6.html"><H2>Part VI. Sequential Programming</H2></A>

<H3>20. Input and Output</H3>
<UL>
<LI>Printing
<LI>Side Effects and Sequencing
<LI>The <CODE>Begin</CODE> Special Form
<LI>This Isn't Functional Programming
<LI>Not Moving to the Next Line
<LI>Strings
<LI>A Higher-Order Procedure for Sequencing
<LI>Tic-Tac-Toe Revisited
<LI>Accepting User Input
<LI>Aesthetic Board Display
<LI>Reading and Writing Normal Text
<LI>Formatted Text
<LI>Sequential Programming and Order of Evaluation
<LI>Pitfalls
</UL>

<H3>21. Example: The <CODE>Functions</CODE> Program</H3>
<UL>
<LI>The Main Loop
<LI>The Difference between a Procedure and Its Name
<LI>The Association List of Functions
<LI>Domain Checking
<LI>Intentionally Confusing a Function with Its Name
<LI>More on Higher-Order Functions
<LI>More Robustness
<LI>Complete Program Listing
</UL>

<H3>22. Files</H3>
<UL>
<LI>Ports
<LI>Writing Files for People to Read
<LI>Using a File as a Database
<LI>Transforming the Lines of a File
<LI>Justifying Text
<LI>Preserving Spacing of Text from Files
<LI>Merging Two Files
<LI>Writing Files for Scheme to Read
<LI>Pitfalls
</UL>

<H3>23. Vectors</H3>
<UL>
<LI>The Indy 500
<LI>Vectors
<LI>Using Vectors in Programs
<LI>Non-Functional Procedures and State
<LI>Shuffling a Deck
<LI>More Vector Tools
<LI>The Vector Pattern of Recursion
<LI>Vectors versus Lists
<LI>State, Sequence, and Effects
<LI>Pitfalls
</UL>

<H3>24. Example: A Spreadsheet Program</H3>
<UL>
<LI>Limitations of Our Spreadsheet
<LI>Spreadsheet Commands
<LI>Moving the Selection
<LI>Putting Values in Cells
<LI>Formulas
<LI>Displaying Formula Values
<LI>Loading Spreadsheet Commands from a File
<LI>Application Programs and Abstraction
</UL>

<H3>25. Implementing the Spreadsheet Program</H3>
<UL>
<LI>Cells, Cell Names, and Cell IDs
<LI>The Command Processor
<LI>Cell Selection Commands
<LI>The <CODE>Load</CODE> Command
<LI>The <CODE>Put</CODE> Command
<LI>The Formula Translator
<LI>The Dependency Manager
<LI>The Expression Evaluator
<LI>The Screen Printer
<LI>The Cell Manager
<LI>Complete Program Listing
</UL>

<H3>Project: A Database Program</H3>
<UL>
<LI>A Sample Session with Our Database
<LI>How Databases Are Stored Internally
<LI>The Current Database
<LI>Implementing the Database Program Commands
<LI>Additions to the Program
<LI>Extra Work for Hotshots
</UL>

<A HREF="part7.html"><H2>Part VII. Conclusion: Computer Science</H2></A>

<H3>26. What's Next?</H3>
<UL>
<LI>The Best Computer Science Book
<LI>Beyond <CITE>SICP</CITE>
<LI>Standard Scheme
<LI>Last Words
</UL>

<H2>Appendices</H2>

<H3>A. Running Scheme</H3>
<UL>
<LI>The Program Development Cycle
<LI>Integrated Editing
<LI>Getting Our Programs
<LI>Tuning Our Programs for Your System
<LI>Loading Our Programs
<LI>Versions of Scheme
<LI>Scheme Standards
</UL>

<H3>B. Common Lisp</H3>
<UL>
<LI>Why Common Lisp Exists
<LI>Defining Procedures and Variables
<LI>The Naming Convention for Predicates
<LI>No Words or Sentences
<LI>True and False
<LI>Files
<LI>Arrays
<LI>Equivalents to Scheme Primitives
<LI>A Separate Name Space for Procedures
<LI><CODE>Lambda</CODE>
<LI>More about <CODE>Function</CODE>
<LI>Writing Higher-Order Procedures
</UL>

<H3>C. Scheme Initialization File</H3>

<H3>D. GNU General Public License</H3>
<H3>Credits</H3>
<H3>Alphabetical Table of Scheme Primitives</H3>
<H3>Glossary</H3>
<H3>Index of Defined Procedures</H3>
<H3>General Index</H3>

<P>
<A HREF="http://mitpress.mit.edu/0262082810">MIT
Press web page for <CITE>Simply Scheme</CITE></A>

<P>
<ADDRESS>
<A HREF="index.html">Brian Harvey</A>, 
<CODE>bh@cs.berkeley.edu</CODE>
</ADDRESS>
<BR>
<ADDRESS>
<A HREF="http://www.cnmat.berkeley.edu/~matt">Matthew Wright</A>,
<CODE>matt@cnmat.berkeley.edu</CODE>
</ADDRESS>
</BODY>
</HTML>