Exercise 195: Argue why the following sentences are now legal definitions:
Explain your reasoning.
We are now allowed to:
- include the names of functions and primitive operations in the definition.
- use variables and function parameters in the first position in a definition
In this case the parameter x is a function that will have the value 10 applied to it. As we can include functions in a function definition this is legal.
In this case, both x and f are functions. This function will call the function x passing in the value of itself (ie f). As we can include functions in function definitions, this is now legal.
In this case f and x are functions, and y is a value (that could potentially be a function!). The function x will be called, with the values 'a, y and 'b being passed into it. At this point y could either be a value, or a function and provided that the function x is expected the actual item in, this code is legal.
No comments:
Post a Comment