F Sharp programming Also given the following: type env = (string * int) list let
ID: 3749865 • Letter: F
Question
F Sharp programming
Also given the following:
type env = (string * int) list
let rec lookup (env: env) x =
match env with
| (y, v) :: r -> if x = y then v else lookup r x
| [] -> failwith (x + " not found")
Explanation / Answer
It's Clearly given that,
e1 = v-(w+z)
e2 = 2*(v-4*w-z)
e3 = x+y+z+v
are of type aepr
Hence the required F# variable is expressed as
e1 = Op2(Sub,Var "v",Op2(Add,Var "w" ,Var "z"))
e2 = Op2(Mul,C 2,Op2(Mul,Op2(Sub,Var "v",C 4),Op2(Sub,Var "w",Var "z")
e3 = Op2(Add,Var "x",Op2(Add,Var "y",Op2(Add,Var "z",Var "v")))
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.