Chapter 1: Building Abstractions(抽象) with Functions
1.1 Getting Started
第1章:利用函数构造抽象
1.1 开始
Computer science is a tremendously(非常地) broad academic(学术的) discipline(学科). The areas of globally distributed(分布式的) systems, artificial(人造的) intelligence(智力), robotics(机器人学), graphics(图形), security, scientific computing, computer architecture(体系结构), and dozens of emerging(浮现) sub-fields all expand(扩张) with new techniques and discoveries every year. The rapid progress of computer science has left few aspects(方面) of human life unaffected. Commerce(贸易), communication, science, art, leisure(空闲的), and politics have all been reinvented(重新使用) as computational(计算的) domains.
计算机科学是一个非常宽广的学科。全球的分布式系统、人工智能、机器人学、图形学、安全、科学计算、计算机体系结构这些领域,还有,每年伴随着新技术和发现,许多浮现的子领域全部扩张。计算机科学的快速进步,使得人类生活方方面面受到了影响。贸易、交流、科学、艺术、休闲和政治,已经全部重新使用计算机领域。
The high productivity(生产力) of computer science is only possible because the discipline(学科) is built upon an elegant(高雅的) and powerful set of fundamental(基本的) ideas. All computing begins with representing information, specifying(指定) logic(逻辑) to process it, and designing abstractions that manage the complexity(复杂) of that logic(设计抽象,用以管理那种逻辑的复杂度). Mastering(精通) these fundamentals(原理;原则;基础) will require us to understand precisely(精确地) how computers interpret(解释) computer programs and carry out(执行;完成) computational processes.
计算机的高生产力,只可能是因为,这个学科建立在一个高雅的、强有力的基本理念集合。所有的计算开始于代表信息、指定逻辑以处理它,并且设计抽象以管理那种逻辑的复杂度。要精通这些原理,会要求我们去精确地理解,计算机如何解释计算机程序、执行计算过程。
These fundamental ideas(基本理念) have long been taught using the classic(经典的) textbook Structure(结构) and Interpretation of Computer Programs (SICP) by Harold Abelson and Gerald Jay Sussman with Julie Sussman. This text borrows heavily from that textbook, which the original authors have kindly licensed(同意;发许可证) for adaptation(改编,改写) and reuse under a Creative Commons license(许可证). These notes(注意事项;说明) are published(出版;公布) under the Creative(创造性的) Commons attribution(归因) non-commericial share-alike license version 3.
这些基本理念在经典的教科书SICP中已经被教授。本文本从那本教科书借鉴了很多,原作者已经友好地许可了,在CCL许可证下,改写和重复使用。这些注意事项,在CCL许可证第3版下被公布。
1.1.1 Programming in Python
1.1.1 在Python中编程
A language isn't something you learn so much as something you join.
—Arika Okrent
一种语言不是你学到很多,而是你参与了很多.
—Arika Okrent
In order to define(定义) computational processes, we need a programming language; preferably(较好) one that many humans and a great variety of computers can all understand. In this text, we will work primarily(首要地,主要地) with the Python language.
为了定义计算过程,我们需要一种编程语言;许多人和大量计算机全都可以理解的更好。在本文本中,我们将主要使用Python编程语言。
Python is a widely used programming language that has recruited(vt.吸收某人为新成员) enthusiasts(狂热者) from many professions: web programmers, game engineers, scientists, academics, and even designers of new programming languages. When you learn Python, you join a million-person-strong community(社区) of developers. Developer communities(社区) are tremendously(极大地;非常) important institutions(机构): members help each other solve problems, share their projects and experiences, and collectively(共同地) develop software and tools. Dedicated(致力) members often achieve celebrity(名誉) and widespread esteem(尊重) for their contributions.
Python是一种广泛使用的编程语言,已经从很多专业领域吸引了爱好者:Web程序员、游戏工程师、科学家、学者,还有甚至新编程语言的设计者。当你使用Python,你加入了一个百万人的、强壮的开发者的社区。开发者社区是非常重要的机构:成员互相帮助、解决问题,分享他们的项目和经验,并且共同开发软件和工具。核心成员经常从他们的贡献中,获得名誉和尊重。
The Python language itself is the product of a large volunteer community that prides(为…自豪) itself on the diversity(多样性) of its contributors(贡献者). The language was conceived(怀孕) and first implemented(实施) by Guido van Rossum in the late 1980’s. The first chapter of his Python 3 Tutorial(教程) explains why Python is so popular, among the many languages available today.
Python编程语言自身,是一个庞大的志愿者社区的产品,该社区为它的贡献者的多样性而自豪。这个语言,在20世纪80年代末期,由Guido孕育,并首次实现。他的Python 3教程的第一章解释了,为什么在如今许多可以使用的语言的情况下,Python如此流行。
Python excels(优于;擅长) as an instructional(教学的) language because, throughout its history, Python’s developers have emphasized(强调) the human interpretability(可解释性)