#python #sicp
Each
general concept or equation maps onto its own short function. One negative
consequence of this approach is that the global frame becomes cluttered with
names of small functions, which must all be unique. Another problem is that we
are constrained by particular function signatures: the update argument to improve must take exactly one argument. Nested function definitions address
both of these problems, but require us to enrich our environment model.
If you want to change selection, open document below and click on "Move attachment"
1.6 Higher-Order Functionstement is executed successfully.
1.6.3 Defining Functions III: Nested Definitions
The above examples demonstrate how the ability to pass functions as arguments
significantly enhances the expressive power of our programming language. <span>Each
general concept or equation maps onto its own short function. One negative
consequence of this approach is that the global frame becomes cluttered with
names of small functions, which must all be unique. Another problem is that we
are constrained by particular function signatures: the update argument to
improve must take exactly one argument. Nested function definitions address
both of these problems, but require us to enrich our environment model.
Let's consider a new problem: computing the square root of a number. In
programming languages, "square root" is often abbreviated as sqrt . Repeated
application of the foll Summary
status | not read | | reprioritisations | |
---|
last reprioritisation on | | | suggested re-reading day | |
---|
started reading on | | | finished reading on | |
---|
Details