A completely revised edition, offering new design recipes for interactive programs and support for images as plain values, testing, event-driven programming, and even distributed programming.
This introduction to programming places computer science at the core of a liberal arts education. Unlike other introductory books, it focuses on the program design process, presenting prog...
A completely revised edition, offering new design recipes for interactive programs and support for images as plain values, testing, event-driven programming, and even distributed programming.
This introduction to programming places computer science at the core of a liberal arts education. Unlike other introductory books, it focuses on the program design process, presenting program design guidelines that show the reader how to analyze a problem statement, how to formulate concise goals, how to make up examples, how to develop an outline of the solution, how to finish the program, and how to test it. Because learning to design programs is about the study of principles and the acquisition of transferable skills, the text does not use an off-the-shelf industrial language but presents a tailor-made teaching language. For the same reason, it offers DrRacket, a programming environment for novices that supports playful, feedback-oriented learning. The environment grows with readers as they master the material in the book until it supports a full-fledged language for the whole spectrum of programming tasks.
This second edition has been completely revised. While the book continues to teach a systematic approach to program design, the second edition introduces different design recipes for interactive programs with graphical interfaces and batch programs. It also enriches its design recipes for functions with numerous new hints. Finally, the teaching languages and their IDE now come with support for images as plain values, testing, event-driven programming, and even distributed programming.
目录
· · · · · ·
Preface
Prologue: How to Program
I Fixed-Size Data
Intermezzo 1: Beginning Student Language
II Arbitrarily Large Data
Intermezzo 2: Quote, Unquote
· · · · · ·
(更多)
Preface
Prologue: How to Program
I Fixed-Size Data
Intermezzo 1: Beginning Student Language
II Arbitrarily Large Data
Intermezzo 2: Quote, Unquote
III Abstraction
Intermezzo 3: Scope and Abstraction
IV Intertwined Data
Intermezzo 4: The Nature of Numbers
V Generative Recursion
Intermezzo 5: The Cost of Computation
VI Accumulators
Epilogue: Moving On
· · · · · · (收起)
In contrast to lists, structures deal with value extractions as a constant time operation.
In general, what we really wish to have in a programming language is:
1.a class of compound values size with constant lookup time,
2.based on ``keys.''
Because the problem is so common, Scheme and most other languages offer at least one built-in solution. (查看原文)
DrScheme also provides a vector analogue to build-list. It is called build-vector. Here is how it works:
1.(build-vector N f) = (vector (f 0) ... (f (- N 1)))
That is, build-vector consumes a natural number N and a function f on natural numbers. It then builds a vector of N items by applying f to 0, ..., N-1.
The operation vector-ref extracts a value from a vector in constant time, that is, for i between 0 and n (inclusive):
2.(vector-ref (vector V-0 ... V-n) i) = V-i
In short, extracting values from a vector is O(1).
If vector-ref is applied to a vector and a natural number that is smaller than 0 or larger than n, vector-ref signals an error.
The operation vector-length produces the number of items in a vector:
3.(vector-length (vector V-0 ... V-n)) = (+ n 1)
The operation vector? ... (查看原文)
2 有用 razors 2024-01-22 16:58:09 北京
如果我早一些看到就好了。作者的写作水平很高,思想深刻,但基本还是入门材料
1 有用 al_lea 2021-07-06 07:40:24
Systematic program design (in a self-indulged world).
2 有用 花狸子 2021-05-06 23:14:32
什么垃圾,看了两百多页,学了个寂寞。我都完看了C pitfalls and traps. expert programming in C. pointers on C的人了,信了邪来看这本书。对于初学者还是很好的,适合高中生,第一次接触编程的人。有经验的建议看看进阶书。