Question: Explain the following typechecking errors in Typelang programs: 1. Check this let expression, explain why it is ill typed, and specify the typechecking rule that

Explain the following typechecking errors in Typelang programs: 

1. Check this let expression, explain why it is ill typed, and specify the typechecking rule that will detect the error.(let ((b: bool #t)) (let ((y num 5)) (+ y b)))

What did the typechecking rule expect, and what did it find?

2. Check this let expression, explain why it is ill typed, and specify the typechecking rule that will detect the error.(let ((x num 2)) (let ((z (num -> num) (lambda (y : num) (+ xy)))) (z #f) ) )

What did the typechecking rule expect, and what did it find? 

3. Check this lambda expression, explain why it is ill typed, and specify the typechecking rule that will detect the error.(lambda (x: num y bool z num) (+ x (+ y z)) )

What did the typechecking rule expect, and what did it find? 

4. Check this lambda expression, explain why it is ill typed, and specify the typechecking rule that will detect the error.((lambda ) (x: num y num z: num) (+ x (+ y z))) 1 2 #f

What did the typechecking rule expect, and what did it find?

5. Check this let expression, explain why it is ill typed, and specify the typechecking rule that will detect the error.(let ((f (num -> (bool -> num)) (lambda (x : num) (lambda (y : num) (+ x y))))) f)

What did the typechecking rule expect, and what did it find?

Step by Step Solution

3.48 Rating (158 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Firstly Typelang appears to be a hypothetical programming language used for the purpose of discussions around type systems and type checking so the ex... View full answer

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 An Experiential Introduction To Principles Of Programming Languages Questions!