Search code examples
schemelispterminologysicp

SICP terminology : difference between procedure and operation


Is the term "procedure" synonymous with the term "operation" in SICP or not? (For example in the chapter below.) If they are not the same, what is the difference and why?

More specifically, what is the difference between "compound operation" and "compound procedure" ? Is there any ?

SICP Chapter 1.1.4 Compound Procedures

Here is an other related chapter from the book :

SICP Chapter 1.2 Procedures and the Processes They Generate

It seems to me that in these contexts the term "operation" in SICP refers to an arithmetic operation (as no other kind of operations - whatever they may be in general - were used in the examples so far).


Solution

  • An "operation" whether primitive or compound, is some actual computation like addition, say in an assembly code of a compiled program, just like a number is an actual computational object, an entity in computer memory.

    A "procedure" is part of a programming language, which expresses/describes operations. A programming language lets us define procedures which express some primitive operations, and by means of combining them, some more complex operations:

    (define (sum x y) (+ x y))   ; a procedure expressing  primitive operation
    
    (define (sum-squares x y)    ; a procedure describing a more complex operation
        (+ (* x x) (* y y)))     ;  defined by means of combining the operations