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 有用 Duke 2018-04-29 16:15:58
额。。。买了之后才想到拿出来看。。。结果发现已经没有看的意义了= =,小学生如果不学pascal而是有htdp学该多好
1 有用 曹操不吃饭 2024-07-27 20:16:49 日本
20240727应该从第五部分生成递归第25章开始看, 确实都是设计函数的好思想,就是例子都太无聊了
0 有用 probability 2008-06-12 23:51:10
看到26章,觉得确实给入门学习编程的人用的,我真的不是初学者了……所以还是读其它的吧……这本就算读完了……
4 有用 codepiano 2014-11-04 22:58:25
更像一本用lisp方言给不会编程的人入门函数式编程的书
0 有用 硅胶鱼 2011-02-28 14:01:11
适合入门,有点罗嗦