Explain the following typechecking errors in Typelang programs: 1. Check this let expression, explain why it is

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 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?

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: