ADVANCED TOPICS IN COMPILER DESIGN
CODE GENERATION FOR OBJECT ORIENTED LANGUAGES
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
applied as an argument to a function that is then used in another function
|
|
applied as an argument to a single function
|
|
applied as an argument to several functions
|
|
applied as an function to another function with several inputs
|
Detailed explanation-1: -Partial application is a process of reducing a function’s arity (the number of its parameters) by creating a new function with some of the arguments passed in.
Detailed explanation-2: -A higher-order function adheres to a very specific definition: It’s first-class (refer back to Chapter 2 if you need a refresher on this topic) Takes a function as an argument. Returns a function as a result.
Detailed explanation-3: -In functional programming language, a function can be passed as an argument to another function. In programming language like C/C++, a function pointer referring to a function can be passed to a function that can invoke the external function through dereference.
Detailed explanation-4: -What can partial functions do for us? A partial function allows us to call a second function with fixed values in certain arguments. For instance, we may have a function that computes an exponentiation. Then, we may need to create a new function that assigns a fixed value to either the base or the exponent.