source-academy / cs1101s

1 stars 0 forks source link

What happens when you evaluate function expression? #23

Open mrqorib opened 3 years ago

mrqorib commented 3 years ago

Question: what happens when you evaluate function expression? Piazza: https://piazza.com/class/kas136yscf8605?cid=930 Answer: A function application is made up of a function sub-expression and any number of argument sub-expressions. In order to evaluate a function application, you'll first need to evaluate those sub-expressions to get their values, before you can apply the value of the function sub-expression to the values of the argument sub-expressions.

For instance:

And so, function_expression simply returns the part of the tagged list that contains the function sub-expression (which is then evaluated to get the value of the sub-exp).