i'm having some trouble wrapping my head on how to utilize the elements of a record in Oz with pattern matching. Below is my code
declare
fun {Eval X E}
case X
of int(N) then N
[] var(X) then E.X
[] mul(X Y) then X*Y
[] add(X Y) then X+Y
end
end
end
{Eval add(var(a) mul(int(3) var(b))) env(a:2 b:4)}
This is the input I have to utilize, the var(a) is supposed to return 2, (and var(b) return 4) from the env record in the input, I just cannot figure it out for anything.