BEST代写-线上留学生作业代写 & 论文代写专家

成立于2015年的老牌留学生代写品牌-BEST代写提供超过百门冷热门留学学科的作业和论文代写服务。全网BEST原创,高质,准时的留学生代写。

Haskell代写|CSE 130 Final

Haskell代写|CSE 130 Final

本次英国代写是一个Haskell语言的限时测试

Q4: Semantics and Type Systems [20 pts]

4.1 Evaluation 1 [5 points]

Which of these evaluation relations are valid according to the operational
semantics of Nano?

(A) [] ; 1 + x ==> 1 [ ]
(B) [] ; (\x -> 1) ==> 1 [ ]
(C) [] ; (\x -> 1) (2 + 3) ==> 1 [X]
(D) [] ; (\x -> x x) (\x -> x x) ==> <[], x, x x> [ ]
(E) [f := <[x:=5],y,x + y>] ; f 1 ==> 6 [X]

4.2 Evaluation 2 [5 points]

Which of the following rules are used in the derivation of the reduction

[] ; (\x y -> x + y) 5 ==> <[x:=5], y, x+y>
(A) E-Num [X]
(B) E-Var [ ]
(C) E-Add [ ]
(D) E-Lam [X]
(E) E-App [X]

4.3 Typing 1 [5 points]

Which of the following typing judgments are valid according to the type
system of Nano?

(A) [x:Int,y:Int] |- x :: Int [X]
(B) [x:Int] |- x + y :: Int [ ]
(C) [] |- \x y -> x :: Int -> Int -> Int [X]
(D) [] |- \x y -> x :: Int -> (Int->Int) -> Int [X]
(E) [] |- \x y -> x :: Int -> Int -> Int -> Int [ ]

4.4 Typing 2 [5 points]

Which of the following rules are used in the derivation of the typing judgment

[] |- (\x y -> x + y) 5 :: Int -> Int
(A) T-Num [X]
(B) T-Var [X]
(C) T-Add [X]
(D) T-Lam [X]
(E) T-App [X]

bestdaixie

评论已关闭。