Procedures Functions - SICP Comparison Edition"/>
The acts of the mind, wherein it exerts its power over simple ideas, are chiefly these three: 1. Combining several simple ideas into one compound one, and thus all complex ideas are made. 2. The second is bringing two ideas, whether simple or complex, together, and setting them by one another so as to take a view of them at once, without uniting them into one, by which it gets all its ideas of relations. 3. The third is separating them from all other ideas that accompany them in their real existence: this is called abstraction, and thus all its general ideas are made.John LockeAn Essay Concerning Human Understanding 1690
We are about to study the idea of a computational process. Computational processes are abstract beings that inhabit computers. As they evolve, processes manipulate other abstract things called data. The evolution of a process is directed by a pattern of rules called a program. People create programs to direct processes. In effect, we conjure the spirits of the computer with our spells.
A computational process is indeed much like a sorcerer's idea of a spirit. It cannot be seen or touched. It is not composed of matter at all. However, it is very real. It can perform intellectual work. It can answer questions. It can affect the world by disbursing money at a bank or by controlling a robot arm in a factory. The programs we use to conjure processes are like a sorcerer's spells. They are carefully composed from symbolic expressions in arcane and esoteric programming languages that prescribe the tasks we want our processes to perform.
A computational process, in a correctly working computer, executes programs precisely and accurately. Thus, like the sorcerer's apprentice, novice programmers must learn to understand and to anticipate the consequences of their conjuring. Even small errors (usually called bugs or glitches) (usually called bugs) in programs can have complex and unanticipated consequences.
Fortunately, learning to program is considerably less dangerous than learning sorcery, because the spirits we deal with are conveniently contained in a secure way. Real-world programming, however, requires care, expertise, and wisdom. A small bug in a computer-aided design program, for example, can lead to the catastrophic collapse of an airplane or a dam or the self-destruction of an industrial robot.
Master software engineers have the ability to organize programs so that they can be reasonably sure that the resulting processes will perform the tasks intended. They can visualize the behavior of their systems in advance. They know how to structure programs so that unanticipated problems do not lead to catastrophic consequences, and when problems do arise, they can debug their programs. Well-designed computational systems, like well-designed automobiles or nuclear reactors, are designed in a modular manner, so that the parts can be constructed, replaced, and debugged separately.
| Original | Python | |
| Original | Python | |
|
Despite its inception as a mathematical formalism, Lisp is a practical programming language. A Lisp interpreter is a machine that carries out processes described in the Lisp language. The first Lisp interpreter was implemented by McCarthy with the help of colleagues and students in the Artificial Intelligence Group of the MIT Research Laboratory of Electronics and in the MIT Computation Center.[1] Lisp, whose name is an acronym for LISt Processing, was designed to provide symbol-manipulating capabilities for attacking programming problems such as the symbolic differentiation and integration of algebraic expressions. It included for this purpose new data objects known as atoms and lists, which most strikingly set it apart from all other languages of the period. |
Despite its inception as a language for scripting and gluing together software components, Python is a general-purpose programming language. A Python interpreter is a machine that carries out processes described in the Python language. The first Python interpreter was implemented by van Rossum at CWI; written in C, it remains the reference implementation of the language and is known today as CPython. Python's most direct ancestor is ABC, a teaching language that van Rossum had helped develop at CWI, from which Python took such traits as the use of indentation to express block structure and a set of rich built-in data types; further influences came from Modula-3 and, for much of its syntax and its implementation, from C. Unlike the original version of this book, which used the Lisp dialect Scheme, Python does not descend from the Lisp tradition. It nonetheless provides the features on which this book most depends—first-class functions, lexical scoping, and dynamic typing. |
| Original | Python | |
|
Lisp was not the product of a concerted design effort. Instead, it
evolved informally in an experimental manner in response to users'
needs and to pragmatic implementation considerations. Lisp's
informal evolution has continued through the years, and the community of
Lisp users has traditionally resisted attempts to promulgate any
|
Unlike Java and C, which are normally compiled to a lower-level language before they run, a Python program is first translated into an intermediate form called bytecode, which is then interpreted by a virtual machine; CPython works in exactly this way, and alternative implementations such as PyPy exist as well. Python is not overseen by a formal standards body. Instead the language is defined by its reference implementation together with the Python Language Reference, and it evolves through a community process organized around design documents called Python Enhancement Proposals, or PEPs. The language has had two major lines: Python 2, which appeared in 2000, and Python 3, which appeared in 2008 and deliberately broke backward compatibility with its predecessor; the two coexisted for more than a decade, until support for Python 2 ended in January 2020 (PEP 373). This book uses Python 3. |
| Original | Python | |
|
Because of its experimental character and its emphasis on symbol manipulation, Lisp was at first very inefficient for numerical computations, at least in comparison with Fortran. Over the years, however, Lisp compilers have been developed that translate programs into machine code that can perform numerical computations reasonably efficiently. And for special applications, Lisp has been used with great effectiveness.[3] Although Lisp has not yet overcome its old reputation as hopelessly inefficient, Lisp is now used in many applications where efficiency is not the central concern. For example, Lisp has become a language of choice for operating-system shell languages and for extension languages for editors and computer-aided design systems. |
The growing use of Python for tasks that demand high performance—above all in scientific computing and data analysis—encouraged work on executing Python programs efficiently. Interpreting bytecode, as CPython does, is rarely the fastest way to carry out a computation. Two responses have proved important. The first, and in practice the more consequential, is to keep the program itself in Python while delegating its numerically intensive parts to libraries written in lower-level languages such as C and Fortran; the widely used NumPy library is the canonical example, and this strategy relies on exactly the cooperation with C described earlier. The second is Just-In-Time (JIT) compilation, in which the frequently executed portions of a program are translated into native machine code as the program runs. PyPy has long applied this technique to good effect, and as of this writing (2026) CPython has begun to incorporate a JIT compiler of its own, though it remains experimental and its performance and future are still being worked out. Python is today among the most widely used programming languages, prominent in fields ranging from web development and automation to scientific computing, data science, machine learning, and the teaching of programming. |