the substitution model for procedure application
the interpreter evaluates the elements of the combination and applies the procedure (which is the value of the operator of the combination) to the arguments (which are the values of the operands of the combination).所称 value 可为方法.
To apply a compound procedure to arguments,evaluate the body of the procedure with each formal parameter replaced by the corresponding argument.以 argument 代入 parameter.
例: (f 5),f is the procedure (sum-of-squares (+ a 1) (* a 2)),再 replace the formal parameter a by the argument 4,(sum-of-squares (+ 5 1) (* 5 2)),再依次 (+ (square 6) (square 10)),(+ (* 6 6) (* 10 10)).
the process is called the substitution model for procedure application.
To apply a compound procedure to arguments,evaluate the body of the procedure with each formal parameter replaced by the corresponding argument.以 argument 代入 parameter.
例: (f 5),f is the procedure (sum-of-squares (+ a 1) (* a 2)),再 replace the formal parameter a by the argument 4,(sum-of-squares (+ 5 1) (* 5 2)),再依次 (+ (square 6) (square 10)),(+ (* 6 6) (* 10 10)).
the process is called the substitution model for procedure application.