Consider the AST Nodes for this lab, the declared type of the eval function in L
ID: 3887262 • Letter: C
Question
Consider the AST Nodes for this lab, the declared type of the eval function in Lab2.scala, and a new function we declare here: def eval(env: Env, e: Expr): Expr def newFunc): Double // Takes no arguments, returns a Double Keeping in mind these declarations, which of the following Scala expressions are valid (well typed)? You may select more than 1. Select one or more: a. newFunc) newFunc) b. eval(empty, N(1)) eval(empty, N(2)!) C. eval(empty, N(newFunc())) Binary(Plus, eval(empty, N(1)), N(3)) e. Binary(Plus, newFunc(), N(3))Explanation / Answer
[a] Correct
Res : Add Two Double value
[b] Correct
Res : Proper Format
[c] InCorrect
Res : N(Return Double value)
[d] Correct
Res: Sum of 2 Exp
[e] InCorrect
Res : Double + Exp can't add
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.