Question: Given the following code: define (outer z) (define x 2) (define (in1) Define z (+ 50 x)) (in2)) (define (in2) (set! z (* z 10))

Given the following code: define (outer z) (define x 2) (define (in1) Define z (+ 50 x)) (in2)) (define (in2) (set! z (* z 10)) z) in1) (define closure (outer 30)) (closure) Draw a contour diagram at the start of line 5 (after calling the closure function on line 12, before calling in2 on line 5). What is the output of this code? (Using lexical scoping) Would this code work using dynamic scope as taught in lecture? If yes, provide the output. If no, explain why not. Given the following code: define (outer z) (define x 2) (define (in1) Define z (+ 50 x)) (in2)) (define (in2) (set! z (* z 10)) z) in1) (define closure (outer 30)) (closure) Draw a contour diagram at the start of line 5 (after calling the closure function on line 12, before calling in2 on line 5). What is the output of this code? (Using lexical scoping) Would this code work using dynamic scope as taught in lecture? If yes, provide the output. If no, explain why not
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
