Procedures Functions - SICP Comparison Edition" />
We have seen that procedures functions are, in effect, abstractions that describe compound operations on numbers independent of the particular numbers. For example, when we declare
Original | JavaScript |
(define (cube x) (* x x x)) | function cube(x) { return x * x * x; } |
Original | JavaScript |
(* 3 3 3) (* x x x) (* y y y) | 3 * 3 * 3 x * x * x y * y * y |
Yet even in numerical processing we will be severely limited in our ability to create abstractions if we are restricted to procedures functions whose parameters must be numbers. Often the same programming pattern will be used with a number of different procedures. functions. To express such patterns as concepts, we will need to construct procedures functions that can accept procedures functions as arguments or return procedures functions as values. Procedures Functions that manipulate procedures functions are called higher-order procedures.functions. This section shows how higher-order procedures functions can serve as powerful abstraction mechanisms, vastly increasing the expressive power of our language.