This is in SML. Small-Step Oriented Semantics (SOS) to be precise. 11. What is t
ID: 3708809 • Letter: T
Question
This is in SML. Small-Step Oriented Semantics (SOS) to be precise.
11. What is the result of evaluating the following expression?
fn x => 1 + 1
1. fn x => 1 + 1
2. fn x => 2
3. 2
4. ill-formed expression
16. What is the result of evaluating the following expression?
(fn x => if true then 1 else 0)
1. if true then 1 else 0
2. 1
3. ill-formed expression
4. none of the above
19. What is the result of evaluating the following expression?
(fn x => (fn y => x + x)) 4
1. (fn y => 4 + 4)
2. (fn y => 8)
3. ill-formed expression
4. none of the above
Explanation / Answer
SOLUTION:-
(11) 4 .ill formed expression
Reason:- Binding of valid variable x is not present along with scope of { } ( int -> int ) is not included also.
(16) 3. I'll formed expression
Reason:- Binding of valid variable x is not included along with scope of { } ( int -> int)
(19) ill formed expression
Reason:- Binding of y with x is not available within the scope of the function
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.