This introduction to programming places computer science in the core of a liberal arts education. Unlike other introductory books, it focuses on the program design process. This approach fosters a variety of skills--critical reading, analytical thinking, creative synthesis, and attention to detail--that are important for everyone, not just future computer programmers.
This introduction to programming places computer science in the core of a liberal arts education. Unlike other introductory books, it focuses on the program design process. This approach fosters a variety of skills--critical reading, analytical thinking, creative synthesis, and attention to detail--that are important for everyone, not just future computer programmers.
The book exposes readers to two fundamentally new ideas. First, it presents 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, based on the analysis; how to finish the program; and how to test. Each step produces a well-defined intermediate product. Second, the book comes with a novel programming environment, the first one explicitly designed for beginners. The environment grows with the readers as they master the material in the book until it supports a full-fledged language for the whole spectrum of programming tasks.
All the book's support materials are available for free on the Web. The Web site includes the environment, teacher guides, exercises for all levels, solutions, and additional projects.
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? ... (查看原文)
0 有用 bored scroller 2014-06-01 13:41:35
没看完就结课系列(
0 有用 硅胶鱼 2011-02-28 14:01:11
适合入门,有点罗嗦
1 有用 unlockingman 2012-10-21 22:46:58
Our textbook, problem solving skills
2 有用 r2g2 2014-09-28 14:05:37
htdp.org
3 有用 魏小兴 2013-03-15 19:53:00
想看SICP的话,可以先读读这本书,做做练习,比SICP简单许多。这本书是免费公开的,而且第二版已经写了很多了,用Racket来描述。想写SICP上的程序,可以先读这本,把Racket熟悉一下