Question: (a) Scoping .For each variable use site in the above code, draw an arrow from the use site to the binding site? Hint : There

(a) Scoping.For each variable use site in the above code, draw an arrow from the use site to the binding site? Hint: There a total of 7 use sites.

(b) Evaluation.Whatdoesf(3)evaluateto?Pleaseshowtheimportantstepsofevaluation using the e steps e in 0 or more steps relation from the course notes: e e. For this question, we will consider function call expressions (e.g., f(3) and g(2)) and the final value important. For example, the first step is f(3) g(2). You are welcome to chain the step relation (e.g., writing e e e v where the es are function call expressions and v is the final value).

(c) Explain briefly in one sentence what function f computes?

(a) Scoping.For each variable use site in the above code, draw anClass notes are not needed...

1. Consider the following function in Scala: def f(n: Int): Boolean = { require (n >= 0) def g(n: Int): Boolean = n match { 2 3 case 0 => false case n => f(n-1) 5 6 n match fi case 0 => true => g(n 8 1) - 10 (a) Scoping. For each variable use site in the above code, draw an arrow from the use site to the binding site? Hint: There a total of 7 use sites. (b) Evaluation. What does f (3) evaluate to? Please show the important steps of evaluation using the "e steps e' in 0 or more steps" relation from the course notes: e* e'. For this question, we will consider function call expressions (e.g., f (3) and g(2)) and the final value important. For example, the first step is f (3)* g(2). You are welcome to chain the step relation (e.g., writing e -* e'-* e"-* .. * v where the e's are function call expressions and v is the final value)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!