156k views
1 vote
Given the Scheme code, answer the following questions.

((lambda (x)
((lambda (x y)
(+ x y))
4 (* 6 x)))
3)
(1) The value to be passed to the parameter y is __ .

User Teran
by
8.2k points

1 Answer

7 votes

Final answer:

The given Scheme code evaluates to the value 22.

Step-by-step explanation:

The given Scheme code is ((lambda (x)((lambda (x y)(+ x y))4 (* 6 x)))3).

To determine the value to be passed to the parameter y, we need to evaluate the expression inside the inner lambda in sequential order.

First, substitute x with the value 3 and calculate (* 6 3), which equals 18.

Then, substitute the result, 18, as the value for x in the outer lambda.

Finally, calculate (+ 4 18), which gives the final result of 22.

User Jeffrey Hines
by
8.3k points